3 ms·
Data structures really clicked for me when I started learning OCaml. While it has its strengths and weaknesses as a language, it has an excellent notation for d
by silentbicycle 16y ago
Data structures really clicked for me when I started learning OCaml. While it has its strengths and weaknesses as a language, it has an excellent notation for data structures. The combination of pattern matching and type inference really clarifies things.*
Whether you use the language in the long run or not, reading chapter two of _Developing Applications with Objective Caml_ (http://caml.inria.fr/pub/docs/oreilly-book/ http://caml.inria.fr/pub/docs/oreilly-book/) and doing its exercises, in OCaml, (http://caml.inria.fr/pub/docs/oreilly-book/html/book-ora020.html http://caml.inria.fr/pub/docs/oreilly-book/html/book-ora020....), will probably help quite a bit, and shouldn't take too long.
* Haskell may help, too, but its emphasis on laziness will also mean many algorithms and data structures won't translate as easily. SML is probably as good as OCaml, but I don't have much experience with it.
- eru 16y agoAnd don't forget "Purely Functional Data Structures".
- silentbicycle 16y agoYes! I originally mentioned that, but it didn't really fit and I cut it. Okasaki's _Purely Functional Data Structures_ uses SML to describe a variety of "purely functional" data structures, most of which are immutable, persistent, and exploit laziness for amortized performance guarantees. (There's an appendix with Haskell versions.)