IntervalVectors-PlainText.txt (12.8 KB) I’m working on a patch to find the pitch class sets that correspond to particular interval vectors. Attached is a table of lists, which takes the form of:

((Interval vector) (corresponding set) (optional: a second corresponding set))

This table will then be encapsulated in a list, as follows:

(

((Interval vector) (corresponding set) (optional: a second corresponding set))

((Interval vector) (corresponding set) (optional: a second corresponding set))

((Interval vector) (corresponding set) (optional: a second corresponding set))

…

)

I want to be able to choose an interval vector (which is the first element in each 2 or 3 element list of interval vectors) and retrieve the corresponding set(s). I used mapcar and first to produce a list of the interval vectors (each of which is a list) but I couldn’t figure out how to compare a list of my-interval-vector to the nested list of all interval vectors to see if it’s there and retrieve its position).

In other words, first and mapcar yield:

((Interval vector) (Interval vector) (Interval vector) …)

then I want to see if (my-interval-vector) is in that list and what its position is so I can retrieve the second and possibly third elements of: ((Interval vector) (corresponding set) (optional: a second corresponding set))

(I hope I’ve been clear. LOL)

Thanks for any help you can provide.

Don

PS: the table is aligned with all of the Forte interval vectors → sets so if I get this patch working I’ll be pleased to share it with everyone.