Wednesday, January 18, 2012

A naive Adler32 example in Clojure and Scala

between administrative intricacies this week, among other things, I took the time to reproduce both in Clojure and Scala a small exercise found in Real World Haskell (RWH).

This blog entry will be very small as I simply provided in each language a way to implement the algorithm.

The algorithm is the Adler32 checksum algorithm as presented in RWH. (You will be able to see the link at the end the protest on the Wikipedia site). Trying to decode the three code samples while the Wikipedia link is blacked out for protest, can be also seen as an interesting exercise :).

The Adler32 algorithm is an algorithm invented by Mark Adler in 1995 and used in the zlib compression library. I see these katas as an interesting mean of learning new things on a daily base (isn't it our job to learn and understand better than use blindly external frameworks?).

For copyright purpose I provide here my version of the algorithm and not the one in the book, as I tried to produce my own haskell version

where I naively used a derive routine in order to dispatch my multimethod using the class function as a dispatcher. My dispatching mechanism resolves now the clojure.lang.LazySeq instances as children of ::collection :

3
comments:

You'll now recover information from pen drive simply. Pen drive brings us unpredictable risk and great convenience. the positioning is always accustomed to save our handy files in an exceedingly pen drive instead of in a very pc.boot disk for windows 7