[Haskell-cafe] help with musical data structures

Stephen Tetley stephen.tetley at gmail.com
Sun Nov 15 11:40:10 EST 2009

Hi Mike

Try it and time it of course - there are a couple of libraries to help
memo-izing on Hackage. Never having used them, but looking at the docs
neither data-memocombinators or MemoTrie would seem to be
straightforward for Data.Set, so a Word32 or some other number that is
an instance of Bits would be a better choice.

My completely unfounded intuition is what you would gain by
memoization you would loose by packing and unpacking the bit
representation to something that can be read, printed or whatever else
you need to do with it.

The only algorithm I've transcribed for finding prime form is the one
detailed by Paul Nelson here:

This one goes out of Z12 at step 2 but if you were using a 24bit bit
vector (e.g. Word32) it would still cope.

Best wishes


2009/11/15 Michael Mossey <mpm at alumni.caltech.edu>:
> Hi Stephen,
> I will need a function that computes prime (normal?) form, of course, and it
> is just begging to be memoized. I wonder if that is possible with Data.Set,
> or whether it would be much faster using the bit vector representation?
> Thanks,
> Mike

More information about the Haskell-Cafe mailing list