Huffman Trees in Haskell
I've recently been learning Haskell. As part of that, I'm implementing Huffman Coding. This is my first real project in the language. It's been overall quite pleasant, and has taught me a lot.
The biggest lesson has been thoroughly meta: compression tasks are a great way to learn a language/environment. For this project, I had to learn how to use modules, do I/O, mangle arrays, and define tree structures. It might not look like too much, but that's actually a huge amount of stuff to shove into a couple weekends of hacking.
Other things I've learned (or relearned), in no particular order:
- You'll get a reasonable answer if you hop on IRC to for help in #haskell.
- "You remember the mental leap from imperative languages to OCaml? I had about the same level of change going from OCaml to Haskell." -- My friend Evan, talking about Haskell (he convinced me to try it, at least).
- The language-of-the-month club is incredibly time-consuming. It took forever to get really basic stuff down in a new language (and I even had the benefit of having already coded some in OCaml).
- A good book makes all the difference. I highly recommend The Craft of Functional Programming. It's a great book, even if you've already been programming in other functional languages.