Thanks for the pointers. Maybe you could clarify some things below:

On Wed, Mar 3, 2010 at 8:50 AM, Ben Rho <dearbenj / yahoo.com> wrote:
>
> Also, could someone with some time give a brief run-through of what
> happens when Evan Hanson's code is run? I don't think I understand it.
> What I think happens:
> Make a new Chord object
> Chord#initialize:
>        
> Map.sharps
>         
> # (I'd use a different method though, becouse susb or something would be
> picked up)

I'm not sure when "susb" would cause an issue -- do you mean an
instance like Gsusb? I don't know that that's a chord, but the G would
be read and the susb would raise an exception as an invalid chord
symbol.

>        
> an error check, @numval=11 if (@numval-=1)<0 to make it easier to port
> to other languages) and changing the value of @name (easier done in my
> opinion by using Map.flats[@numval])

Yes, the Map should probably loop. RIght now things like Cb are just
thrown out as invalid.

>           
> error check, @numval=0 if (@numval+=1)==12 to make it easier to port to
> other languages) and changing the value of @name (easier done in my
> opinion by using Map.sharps[@numval])

Same as above. I wrote the flat! and sharp! methods before I started
using the twelve-tone arrays, otherwise I might have done it that way.

> Chord#to_s:
>   > But that would only return the input in a fancy way! I don't see how it
> returns chords.

It actually returns the individual notes in the chord, as generated by
Chord#names.

As an aside, can anyone tell me if there is a slick Ruby way to do
what is done in cases like my Key#names, Chord#names, Chord#to_s, etc.
functions, where you're just mapping things from one array to another,
or from one array to a string, etc?