Jump to content

Talk:Pure function

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 140.32.183.252 (talk) at 19:32, 5 November 2014 (alternate usage of the term:: new section). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

WikiProject iconComputing Unassessed
WikiProject iconThis article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
???This article has not yet received a rating on Wikipedia's content assessment scale.
???This article has not yet received a rating on the project's importance scale.

Template:Findsourcesnotice Pure functions are required to construct pure expressions.

What does this mean? --Abdull (talk) 22:33, 31 March 2009 (UTC)[reply]

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)[reply]

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 (talkcontribs) 13:24, 7 July 2010 (UTC)[reply]

alternate usage of the term:

the term definition provided here seems to be hardly in common usage See here for discussion and reference list

http://mathematica.stackexchange.com/a/64624/2079