The Beginning and End.

OCaml! Haskell! Gunzip!

For a couple of days, I told myself that I would study OCaml now that I have a decent grasp of Haskell. But it’s actually been pretty difficult to leave Haskell because I am rather enamoured with the language. ❤

I did however, manage to read through a good chunk of OCaml from the Very Beginning, and work through the exercises that accompany each chapter. I found it to be a very solid introductory text, as the author makes no assumptions about the reader’s background. I plan to finish it up at some point, and move on to Real World OCaml.

A couple of things that jumped out at me as I started learning OCaml:

  • The standard library is pretty sparse. Will be checking out Jane Street’s Core.
  • There are mutable data structures.
  • OCaml supports imperative and functional styles.
  • The introductory text, at least OCaml from the Very Beginning, emphasized understanding tail recursion (which I didn’t really think about when learning Haskell, but maybe I did it wrong)
  • Utop is pretty cool.
  • I got confused by = and == because I wanted to use == but that seems to be reserved for people who really know what they’re doing.

For the past few days, I have been exploring file compression and decompression. I needed a new project and starting looking at what previous HSers had done, and I found this blog post by alumna Julia Evans on implementing gunzip in Julia. So I’ve decided to implement it in Haskell! :D :D :D

I’ve been reading up on the algorithm specifications for inflating and deflating and the format information. I tried looking at the source in C but my head started to hurt, so I have been studying Julia’s implementation, which despite me never having seen Julia code before, has been very helpful.

I spent today working on parsing a gzipped file’s header and metadata information. Tomorrow I will read up more on the algorithm description and dive into implementing inflate.