Thursday, July 15, 2010

wumpus-tree

Copperbox revision 1506.

I've changed the tree drawing algorithm to uses absolute extents rather than relative ones.

The code code was previously taken verbatim from Andrew Kennedy's "Functional Pearls: Drawing Trees" with a bit of Haskell golf sprinkled on top - adding a Monoid instance for Extent and using a Hughes list to avoid one reverse. I was unhappy about using someone else's code wholesale, but I wanted to get to actually drawing pictures quickly to see if the project would be worthwhile.

As I got up to picture drawing yesterday, today I thought I'd see if I could adapt the algorithm to use absolute extents (suggested as an exercise in the paper). I think I've done this - I'm not 100 percent sure my version is correct, but it works for my limited test cases. Also while I'm indebted to Andrew Kennedy for the original code and the paper explaining it, I think the code in Wumpus-tree is now sufficiently independent that I can publish it on Hackage if and when the larger library is good enough.

Many thanks to Andrew Kennedy for a remarkably clear paper and code - it was a pleasure working through it.

Blog Archive

About Me

My photo
Disambiguating biog as there are a few Stephen Tetley's in the world. I'm neither a cage fighter or yachtsman. I studied Fine Art in the nineties (foundation Bradford 1992, degree Cheltenham 1992 - 95) then Computing part-time at Leeds Met graduating in 2003. I'm the Stephen Tetley on Haskell Cafe and Stackoverflow.