Partial discharge: Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
 
en>Alibongo0708
Line 1: Line 1:
My name is Alejandrina Zinnbauer. I life in Drammen (Norway).<br><br>Feel free to surf to my web blog :: [http://www.freezehousebnb.com/louboutin.html cheap christian louboutin shoes]
'''Purely functional''' is a term in [[computing]] used to describe [[algorithm]]s, [[data structure]]s, or [[programming language]]s that exclude ''destructive modifications'' (updates) of entities in the program's [[running environment]].  According to this restriction, [[Variable (programming)|variables]] are used in a mathematical sense, with identifiers referring to [[immutable]], persistent values.  Other side-effects, e.g. network communication or console output, are represented as function evaluations instead of entities with updated values.
 
To represent computations that perform side-effects in a purely functional programming language, one can use [[Monad (functional programming)|Monad]]s, as proposed by [[Philip Wadler]].<ref>[http://journals.cambridge.org/action/displayAbstract?fromPage=online&aid=4439732 ''Comprehending Monads''] by [[Philip Wadler]], [[Cambridge University Press]], Mathematical Structures in Computer Science / Volume 2 / Issue 04 / December 1992, pp 461-493</ref>
 
[[Haskell (programming language)|Haskell]] is the most common modern example of a purported pure [[functional programming|functional programming language]] however the mutable reference feature of its IO monad effectively renders it impure.<ref>[http://wiki.comlab.ox.ac.uk/algprog/FrontPage?action=AttachFile&do=get&target=alvaro_garcia_20090529.pdf ''A Functional Approach to the Observer Pattern''] by Alvaro Garcia Perez</ref>
 
Purely functional [[data structure]]s are often represented in a different way than their [[imperative programming|imperative]] counterparts.<ref>[http://www.cambridge.org/us/academic/subjects/computer-science/algorithmics-complexity-computer-algebra-and-computational-g/purely-functional-data-structures ''Purely functional data structures''] by [[Chris Okasaki]], [[Cambridge University Press]], 1998, ISBN 0-521-66350-4</ref>
 
== Benefits and applications ==
 
The persistence property of purely functional data structures can be advantageous in the development of many applications that deal with multiple versions of an object.
 
For example, consider a comprehensive web-based thesaurus service that uses a large [[red-black tree]] to store its list of synonym relationships, and that allows each user to add their own custom words to their personal thesaurus. One way to do this is to make a copy of the tree for each user, and then add their custom words to it; however, this duplication is wasteful, both of space and of time.
 
A better approach is to store the words in an immutable (and therefore purely functional) red-black tree. Then, one can simply take the original version and produce a new tree based on it for each set of custom words. Because these new trees share large amounts of structure with the main tree, the space overhead for each additional user is at most <math>2 k \log_2 n</math>, where <math>k</math> is the number of custom nodes. With a mutable red-black tree, this approach would not work, since changes to the main tree would affect all users.
 
Besides their efficiency benefits, the inherent [[Referential transparency (computer science)|referential transparency]] of functional data structures tends to make purely functional computation more amenable to analysis and optimization, both formal and informal.
 
==See also==
*[[Pure function]]
*[[Persistent data structure]]
*[[VList]]
*[[Identity (object-oriented programming)]]
 
== Bibliography ==
{{reflist}}
 
==External links==
*[http://www.cs.cmu.edu/~rwh/theses/okasaki.pdf Purely Functional Data Structures] thesis by Chris Okasaki (PDF format)
*[http://www.cs.cmu.edu/~sleator/papers/making-data-structures-persistent.pdf Making Data-Structures Persistent] by James R. Driscoll, Neil Sarnak, Daniel D. Sleator, Robert E. Tarjan (PDF)
*[http://www.cs.cmu.edu/~sleator/papers/fully-persistent-lists.pdf Fully Persistent Lists with Catenation] by James R. Driscoll, Daniel D. Sleator, Robert E. Tarjan (PDF)
*[http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-854j-advanced-algorithms-fall-2005/lecture-notes/persistent.pdf Persistent Data Structures] from MIT open course [http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-854j-advanced-algorithms-fall-2005 Advanced Algorithms]
 
[[Category:Functional programming]]
[[Category:Functional data structures| ]]

Revision as of 21:37, 31 January 2014

Purely functional is a term in computing used to describe algorithms, data structures, or programming languages that exclude destructive modifications (updates) of entities in the program's running environment. According to this restriction, variables are used in a mathematical sense, with identifiers referring to immutable, persistent values. Other side-effects, e.g. network communication or console output, are represented as function evaluations instead of entities with updated values.

To represent computations that perform side-effects in a purely functional programming language, one can use Monads, as proposed by Philip Wadler.[1]

Haskell is the most common modern example of a purported pure functional programming language however the mutable reference feature of its IO monad effectively renders it impure.[2]

Purely functional data structures are often represented in a different way than their imperative counterparts.[3]

Benefits and applications

The persistence property of purely functional data structures can be advantageous in the development of many applications that deal with multiple versions of an object.

For example, consider a comprehensive web-based thesaurus service that uses a large red-black tree to store its list of synonym relationships, and that allows each user to add their own custom words to their personal thesaurus. One way to do this is to make a copy of the tree for each user, and then add their custom words to it; however, this duplication is wasteful, both of space and of time.

A better approach is to store the words in an immutable (and therefore purely functional) red-black tree. Then, one can simply take the original version and produce a new tree based on it for each set of custom words. Because these new trees share large amounts of structure with the main tree, the space overhead for each additional user is at most , where is the number of custom nodes. With a mutable red-black tree, this approach would not work, since changes to the main tree would affect all users.

Besides their efficiency benefits, the inherent referential transparency of functional data structures tends to make purely functional computation more amenable to analysis and optimization, both formal and informal.

See also

Bibliography

43 year old Petroleum Engineer Harry from Deep River, usually spends time with hobbies and interests like renting movies, property developers in singapore new condominium and vehicle racing. Constantly enjoys going to destinations like Camino Real de Tierra Adentro.

External links

  1. Comprehending Monads by Philip Wadler, Cambridge University Press, Mathematical Structures in Computer Science / Volume 2 / Issue 04 / December 1992, pp 461-493
  2. A Functional Approach to the Observer Pattern by Alvaro Garcia Perez
  3. Purely functional data structures by Chris Okasaki, Cambridge University Press, 1998, ISBN 0-521-66350-4