[Haskell-beginners] if ands

Stephen Tetley stephen.tetley at gmail.com
Fri Nov 6 04:36:39 EST 2009

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


2009/11/6 Deniz Dogan <deniz.a.m.dogan at gmail.com>:
> 2009/11/6 Keith Sheppard <keithshep at gmail.com>:

> 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.

More information about the Beginners mailing list