Dear Chris,
Aside from the points raised by others already, I wanted to add a
small point. Aside from +'s commutativity. The + you use here can not
be transformed the way you point out. Looking at the types:
f :: Fractional a = a - a - a
g :: t - t
In the expression
g x + f x
the type of +
Hi,
Is lazy evaluation necessary for a functional language to remain
functional?
The reason I ask is that because it violates beta-reduction, and also
referential transparency (I think). In haskell, we can transform:
g x + f x
into:
f x + g x
as both f and g do not change the parameter x.
Chris,
I'm not sure what exactly your question is as you are mixing up several
concepts. However, you start with:
In haskell, we can transform:
g x + f x
into:
f x + g x
Here you assume that the function + is commutative. Although this is
probably true for all numeric types in all
Many arguments have been had about what it means for a language to be
functional, so that's probably not a productive line of discussion.
(ICFP carefully doesn't stipulate language choice for the programming
contest, for example.)
Both eager and lazy evaluation can be pure, providing
Hi Jeremy,
Thanks for this very informative answer! This has certainly helped to
clear up a number of points.
Thanks,
Chris.
Many arguments have been had about what it means for a language to be
functional, so that's probably not a productive line of discussion.
(ICFP carefully doesn't