»
S
I
D
E
B
A
R
«
A new web site and a new hackage package.
Jun 29th, 2009 by Axman6

After years of wanting to, I finally bought axman6.com. I’m using the quite awesome nearlyfreespeech.net for my hosting, because they’re damn cheap, and seem to runs things very nicely.

Now for the interesting stuff. I’ve been working over the last few days on implementing a new Set and Map library for haskell, which I released yesterday on Hackage, called imaginatively TernaryTrees. I got the idea from a PC Plus article [Via: Reddit.com], and couldn’t quite get the whole idea into my head at once, so decided to try implementing it in the best language I knew, haskell.

It turns out this was a good idea; without much work at all, I’ve ended up with a rather efficient implementation, which can be used for either efficient Sets of Strings, or Sets or Maps of any Ord a => [a]. The thing I’m most happy about is how nice I managed to make the Data.Binary implementation. By using a little bit of binary number trickery, I’ve managed to save an awful lot of space (The {T,S}End notes only requite 1 bit of information saying whether they’re there or not and these bits are stored in the same byte that marked whether we has a {T,S}Node or {T,S}End). When using this to write the StringSet out to a binary file, I’ve been able to get a the output to be compressed by over 40% in one case (though this doesn’t seem to be typical sadly :( )

There’s not much more I want to say about this for now, maybe later, but I suggest you go and take a look at the source and see how easy this all was.

– Axman

»  Substance: WordPress   »  Style: Ahren Ahimsa
© Alex Mason (Axman6) 2009