Re: Pure functions?
- To: mathgroup at smc.vnet.net
- Subject: [mg93234] Re: Pure functions?
- From: Albert Retey <awnl at gmx-topmail.de>
- Date: Sat, 1 Nov 2008 05:04:34 -0500 (EST)
- References: <firstname.lastname@example.org>
Hi, > So, what _is_ the real story on "pure functions"? I think from your lengthy considerations there is a clear point: There is a mismatch between the meaning of a pure function as used in Mathematica and the definition of a pure function as given by wikipedia. The Mathematica documentations uses 'pure function' as a description for expressions with head Function, which in the wikipedia-sense are 'anonymous functions'. Using something like: f=#^2& as a counter example is misleading, since here we only have a variable f that holds as its (Own-)value a anonymous function, that doesn't make the Function-expression have a name. A Mathematica 'pure function' can be pure or impure in the wikipedia sense depending on what its body contains: #^2& is pure in the wikipedia sense #*Date& is impure (depends on external state) Export[#]& is impure (has side effects) I don't think that there is any conceptual difficulty here at all, the only question is, whether picking 'pure function' in the mathematica documentation as a term for something that other people might call 'anonymous function' turned out to be a good choice or not. My experience with computer science talk is that many of these terms are by far not as 'common' as one might think or wish. When you then consider that Mathematica has quiet a history, it would certainly cause much confusion among long term users of mathematica if that would now be changed in the documentation, even if nowadays 'anonymous function' would be an excepted standard (which I am not convinced of just because of wikipedia). So I'm afraid you will just need to learn to live with that mismatch... By the way, I personally would prefer 'anonymous function' because unlike 'pure function' the term addresses quite clearly which aspect of a function is considered, but I have never had problems with understanding the mathematica documentation because of that. hth, albert