
john:
On Tue, Jun 22, 2010 at 06:24:22PM +0100, Andrew Coppin wrote:
John Meacham wrote:
In particular, a Huffman coding: http://en.wikipedia.org/wiki/Huffman_coding is ideal for this (assuming you just are taking advantage of frequency analysis). A dynamic Huffman Tree will even adapt as it is being used to whatever the current language is. Huffman Trees are easy and fun to implement too.
Interestingly, Huffman coding is one of those problems with a trivially simple mathematical expression, which none the less turns out to be difficult to express succinctly in Haskell. Oh, you can *do* it. It just seems to take a surprising amount of typing...
Hmmm.... Do I hear a challenge? :)
Actually, I can't find my huffman code at the moment, I would be curious what others take on the problem was.
http://hackage.haskell.org/package/huffman A simple and pure Haskell implementation of the Huffman encoding algorithm. Google turns up a lot of results.