[Haskell-cafe] Re: Why?
dev at mobileink.com
Thu Dec 10 11:39:50 EST 2009
On Thu, Dec 10, 2009 at 9:13 AM, John D. Earle <JohnDEarle at cox.net> wrote:
> Most of the discussion centers on the benefits of functional programming
> and laziness. Haskell is not merely a lazy functional language. It is a pure
> lazy functional language. I may need to explain what laziness is. Laziness
> is where you work through the logic in its entirely before acting on the
> result. In strict evaluation the logic is worked out in parallel with
> execution which doesn't make complete sense, but it does allow for an
> architecture that is close to the machine.
Just to roil the waters a bit: no programming language can ever hope to be
"purely functional", for the simple reason that real computation (i.e.
computation involving IO, interactivity) cannot be functional. "Functional
programming" is an unfortunate misnomer. On the other hand, languages can
be algebraic. The whole point is provability, not function-ness.
More generally: judging by the many competing proposals addressing the
issue of how to think formally about real computation (just google stuff
like hypercomputation, interactive computation, etc.; Jack
lots of interesting stuff on this) is still an open question. Soare
three essential papers
<http://www.people.cs.uchicago.edu/%7Esoare/History/>on the subject.
I guess the moral of the story is that the concepts and the
terminology are both still unstable, so lots of terms in common use are
rather ill-defined and misleading (e.g. functional programming).
Lazyness is just a matter of how one attaches an actual computation to an
expression; a better term would be something like "delayed evaluation" or
"just-in-time computation". You don't have to work through any logic to
have laziness. Just think about how one reads a mathematical text - you
need not actually compute subformulae or even analyze them logically in
order to work with them. This applies right down to expressions like "2+3"
- one probably would compute "5" on reading that, but what about
"12324/8353"? You'd leave the computation until you absolutely had to do it
- i.e. one would probably try to eliminate it algebraically first.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe