
6 Nov
2009
6 Nov
'09
4:36 a.m.
As Haskell uses lazy evaluation so (&&) and if can be functions, as
Joe Fredette said previously. In say Lisp which is strict if has to be
a primitive / special form and (&&) is likely definable only with if
(or implemented as another primitive).
In some senses Haskell doesn't need to be smart to be 'smart'.
Best wishes
Stephen
2009/11/6 Deniz Dogan
2009/11/6 Keith Sheppard
:
Note that Haskell is far from the only programming language that is smart about this. I actually can't think of a single programming language implementation that I know of which isn't this smart...
For what it's worth, Haskell (and others) is smart about ORs as well. In (x || y), y will only be evaluated if x is False.