Rough Haskell and OCaml comparison
Richard Uhtenwoldt
ru at river.org
Mon Mar 19 13:33:31 EDT 2007
Kragen Javier Sitaker writes:
> It seems
>to me that lazy evaluation only requires whole-program analysis when
>you want to know how fast something is or how much memory it needs,
>while mutable variables potentially require whole-program analysis to
>know what value some function computes. (There are various ways to
>limit the scope of analysis required, of course, so whole-program
>analysis is not always needed.)
>
>To the kind of functional programmer who "knows the value of
>everything and the cost of nothing," the above paragraph should make
>it clear that lazy evaluation is superior. But, myself, I'm often
>just as interested in the speed of my code as in whether it's correct,
>partly because I've found that it's often easier to make incorrect
>code correct than to make slow code fast.
What Kragen writes here is a good two-paragraph summary of the
advantages and disadvantages of the functional programming paradigm.
I, too, am frustrated by the lack of control over characteristics
like execution time and have engaged in (amateur) research to try
to preserve some of the benefits -- particularly, referential
transparency -- of functional programming while allowing more of
the control over execution time available to imperative
programmers. (The research has arrived at a style in which
programs use the IO monad very heavily.)
Richard
More information about the Kragen-discuss
mailing list