Talk:Pure function
Appearance
Computing Unassessed | ||||||||||
|
Template:Findsourcesnotice Pure functions are required to construct pure expressions.
What does this mean? --Abdull (talk) 22:33, 31 March 2009 (UTC)
Examples?
- It is possible for a pure expression to yield an impure function (or more generally a value which contains one or more impure functions).
- It is also possible for an expression to be pure even if one or more of the argument subexpressions yields an impure function (or a value which contains one or more impure functions).
Can someone give examples for these cases? Thanks, --Abdull (talk) 11:02, 23 January 2010 (UTC)
- How about this Javascript for the first one:
var count;
function foo()
{
- return function()
- {
- count++;
- };
}
Foo is pure because it always returns the same function, but the function it returns is impure since it has the side effect of modifying the count variable. —Preceding unsigned comment added by GalaxiaGuy (talk • contribs) 13:24, 7 July 2010 (UTC)
alternate usage of the term:
the term definition provided here seems to be hardly in common usage See here for discussion and reference list