[Haskell-cafe] Re: Haskell as a first language?
Ahn, Ki Yung
kyagrd at gmail.com
Tue Jul 14 13:40:51 EDT 2009
Before teaching any data structure course, one MUST learn functional
languages with ADTs. It makes everything so easy to understand. So, it
MUST be a first language in every institution.
The biggest reason that one should learn functional languages with
algebraic data type(ADT)s first is because understanding recursive
definitions. If you recursion first, understanding iteration and
mutable data structures are dead simple and easy: they are just
alternate representation or optimization.
However, when you learn while loops and for loops first, your brain gets
damaged and a lot of students gets stuck when they first see the Tower
of Hanoi, the notorious in-place quicksort routine written in imperative
languages, you'll get to think of recursion as some stack blowing up
monster that must be unrolled and managed manually. Furthermore,
learning data structures in most traditional imperative language
literature gives you the impression that linked list and binary trees
are brain-fucking spaghetti monsters of memory pointers all the cells,
which is a dead simple recursive definition in functional languages with
ADTs.
Personally, I never really understood what linked list was before I
learned ML and Haskell, although I've used doubly linked list in a C++
standard library, which was to me a black box that meets the
specification in some huge standard document, for two years.
More information about the Haskell-Cafe
mailing list