Re: [Haskell-cafe] help with musical data structures

2009-11-16 Thread wren ng thornton
Stephen Tetley wrote: Hello Mike A pitch class set represents Z12 numbers so I'd define a Z12 number type then store it in a list (if you have need a multiset - duplicates) or Data.Set (if you need uniqueness). If you want an efficient implementation for *sets* of Z12 numbers I'd recommend

Re: [Haskell-cafe] help with musical data structures

2009-11-15 Thread Stephen Tetley
Hello Mike A pitch class set represents Z12 numbers so I'd define a Z12 number type then store it in a list (if you have need a multiset - duplicates) or Data.Set (if you need uniqueness). Having a Z12 numeric type isn't the full story, some operations like finding prime form have easier

Re: [Haskell-cafe] help with musical data structures

2009-11-15 Thread Henning Thielemann
On Sat, 14 Nov 2009, Michael Mossey wrote: I'm pretty new to Haskell so I don't know what kind of data structure I should use for the following problem. Some kind of arrays, I guess. One data item, called OrientedPCSet (oriented pitch class set, a musical term) will represent a set whose

Re: [Haskell-cafe] help with musical data structures

2009-11-15 Thread Stephen Tetley
Postscript... Hi Mike I rather overlooked your efficiency concerns, however I wouldn't be so concerned. By the nature of what they represent I wouldn't expect pitch classes to grow to a size where a bit representation out weighs the convenience of a list or Data.Set. By the same reason - I'd

Re: [Haskell-cafe] help with musical data structures

2009-11-15 Thread Stephen Tetley
2009/11/15 Henning Thielemann lemm...@henning-thielemann.de: In Haskore there is a type for pitch classes: http://hackage.haskell.org/packages/archive/haskore/0.1/doc/html/Haskore-Basic-Pitch.html  but maybe it is not what you need, since it distinguishes between C sharp and D flat and so

Re: [Haskell-cafe] help with musical data structures

2009-11-15 Thread Michael Mossey
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 Stephen Tetley wrote: Postscript...

Re: [Haskell-cafe] help with musical data structures

2009-11-15 Thread Stephen Tetley
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

Re: [Haskell-cafe] help with musical data structures

2009-11-15 Thread Hans Aberg
On 15 Nov 2009, at 12:55, Stephen Tetley wrote: http://hackage.haskell.org/packages/archive/haskore/0.1/doc/html/Haskore-Basic-Pitch.html but maybe it is not what you need, since it distinguishes between C sharp and D flat and so on. The enharmonic doublings and existing Ord instance

[Haskell-cafe] help with musical data structures

2009-11-14 Thread Michael Mossey
I'm pretty new to Haskell so I don't know what kind of data structure I should use for the following problem. Some kind of arrays, I guess. One data item, called OrientedPCSet (oriented pitch class set, a musical term) will represent a set whose members are from the range of integers 0 to 11.