[Haskell-cafe] let and fixed point operator
jerzy.karczmarczuk at info.unicaen.fr
jerzy.karczmarczuk at info.unicaen.fr
Thu Aug 30 17:58:00 EDT 2007
Dan Piponi writes:
>> In mathematics, if you write "x = f y" you mean that these two
>> expressions are equal. In Haskell, if you say "x = f y" you mean *make*
>> then equal!
> Haskell is a declarative language, not an imperative language. When
> you write "x = f x" in Haskell, you're declaring to the compiler that
> x equals f x. In an imperative language like Java, the line x = f(x)
> gives the compiler the imperative to emit instructions to store the
> value of f(x) in a 'box' called x. In Haskell, there is no box.
Well, there are boxes...
But there also thunks and latent, yet-unevaluated graphs...
Anyway, I believe strongly that ALL people who have problems with the
Haskell protocole, and they are numerous, I teach a good sample of them,
should be encouraged to learn Prolog. IN DEPTH, and I mean it, Andrew
Coppin and Peter Hercek !
In Prolog A=B is the unification, which is a bit more than equality, and
something much more aggressive than an assignment. When you REALLY
understand unification, it will be easier to see the lazy instantiation
of the Haskell assignment, and, additionally, it becomes much more easy
to understand the automatic inference of types, which sooner or later
must be harnessed by all Haskell programmers...
The best.
Jerzy Karczmarczuk
More information about the Haskell-Cafe
mailing list