4 ms·
I must have missed that explanation. What would the use of a really pure functional programming language be? One with no side-effects, not even printing to a co
by kenko 12y ago
I must have missed that explanation. What would the use of a really pure functional programming language be? One with no side-effects, not even printing to a console? (How are you going to get the answer to your computation back out?)
- theoh 12y agoOK, maybe I didn't make myself clear. Basically I am just saying that a "useless" pure functional language as characterised by Peyton Jones is equivalent to a souped-up desk calculator. You type an expression in (a form of IO provided by the runtime), you press Enter, and you get a value back. This is far from useless, nothing to he ashamed of. A "classic" bit of functional programming like Hutton's solution of the Countdown problem requires nothing more. http://www.cs.nott.ac.uk/~gmh/bib.html#countdown http://www.cs.nott.ac.uk/~gmh/bib.html#countdown I reckon a lot of people want to use that kind of machine, though it rules out systems programming. See for example the requirements expressed in this article: http://www.americanscientist.org/issues/pub/calculemus http://www.americanscientist.org/issues/pub/calculemus
- ZenoArrow 12y agoA desk calculator manipulates state, does it not?
- theoh 12y agoSo do the implementations of functional programming languages.
- ZenoArrow 12y agoAll the state-altering functions of Haskell are kept separate from the non-state-altering ones. That's what makes Haskell "pure functional" as opposed to "functional". The state-changing functions were designed after the non-state-changing ones, which is what we've been trying to tell you!
- theoh 12y agoGood grief. I said the _implementation_, not the language. They all use mutable state. Go read a paper. http://research.microsoft.com/apps/pubs/default.aspx?id=67083 http://research.microsoft.com/apps/pubs/default.aspx?id=6708...
- kenko 12y agoHow do you get the value back?