Concept:
Pure function
Headline
A function with referential transparency
Details
See the notion of impure function for comparison.
For instance, functions in Language:Haskell are pure.
Concept:
Impure function
Headline
an implemented function that computes the result with side effects on data
Details
See the notion of pure function for comparison.
For instance, a method in OO programming, with access to instance or static attributes, describes an impure function.
Language:
Haskell
Headline
The functional programming language Haskell
Details
101wiki hosts plenty of Haskell-based contributions. This is evident from corresponding back-links. More selective sets of Haskell-based contributions are organized in themes: Theme:Haskell data, Theme:Haskell potpourri, and Theme:Haskell genericity. Haskell is also the language of choice for a course supported by 101wiki: Course:Lambdas_in_Koblenz.
Illustration
The following expression takes the first 42 elements of the infinite list of natural numbers:
> take 42 [0..]
[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41]
In this example, we leverage Haskell's lazy evaluation.