
jerzy.karczmarczuk@info.unicaen.fr wrote:
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...
I did once try to learn Prolog. And failed. Miserably. I just couldn't bend my head around how the Prolog interpreter manages to make seemingly "impossible" leaps of deduction. (It's a *machine*! How can it deduce arbitrarily complex conclusions from any arbitrary set of axioms? That requires *intelligence*!) And yet, in other, seemingly identical cases, it utterly fails to deduce patently *obvious* results... really weird! And then I read a book. A golden book. (No, seriously. The cover is gold-coloured.) It was called "The Fun of Programming". And it demonstrates how to write a Haskell program that performs exactly the same "impossible" feats. And now, finally, it makes sense. (I still have no idea what the hell all that business with the "cut" operator is though...)