[Haskell-cafe] hash-cons

Tony Finch dot at dotat.at
Sun Jan 13 16:27:52 EST 2008


I've been thinking about hashlife recently. I've written part of a fairly
didactic C implementation <http://dotat.at/prog/misc/hashlife.c> but I
there are more interesting things that can be done with it.

In particular, the core calc2() function is essentially implementing lazy
evaluation, so it ought to be possible to write it even more nicely in
Haskell. However it relies crucially on a hash-cons aka intern aka
memoized constructor find(). How can one implement this in Haskell?
Google doesn't turn up anything very helpful.

If I can solve the hash cons problem, then it ought to be fairly
straightforward to use Parallel Haskell to speed up the algorithm on
multicore machines.

Tony.
-- 
f.a.n.finch  <dot at dotat.at>  http://dotat.at/
PORTLAND: SOUTH 7 TO SEVERE GALE 9 VEERING SOUTHWEST 5 TO 7. ROUGH OR VERY
ROUGH. RAIN AT FIRST, THEN SQUALLY SHOWERS. MODERATE OR GOOD.


More information about the Haskell-Cafe mailing list