Just another Perl shrine | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hello, I'm writing Yet Another Guitar Chord Finder(tm), and as such I want to be able to map easily between note names and their positions in the chromatic scale. I want to be able to find that A is the first note on the chromatic, and that the second note on that scale is A#. My first instinct was to use a hash, but that only gets me one direction. I can always build a second "backwards" hash:
but I don't really like the idea of having two hashes that express basically the same thing. (Semantically, I know, the hashes don't, but the data are bijective, and I should be able to do it with one structure, dammit!) Two hashes probably isn't a bad WTDI, but is there a better way? -- In reply to Bijective data association structure? by FoxtrotUniform
|
|