[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Generating music from a list of identifiers
From: |
Trevor Daniels |
Subject: |
Re: Generating music from a list of identifiers |
Date: |
Wed, 1 Apr 2015 21:27:40 +0100 |
David Kastrup wrote Wednesday, April 01, 2015 8:36 PM
> "Trevor Daniels" <address@hidden> writes:
>
>> I'm struggling to find how to do the following:
>>
>> I have a list of the identifiers of variables which contain either music or
>> #f and I'd like to generate the parallel music of all of them which contain
>> music. I can do this by listing the identifiers explicitly, like this:
>>
>> AllMusic = <<
>> #(if DescantMusic DescantMusic)
>> #(if SopranoMusic SopranoMusic)
>> ...
>> #(if PianoLHMusic PianoLHMusic)
>>>>
>>
>> But I'd like to do the same thing without listing each one explicitly, using
>> a list like this, which is generated algorithmically:
>>
>> #(define AllMusicNames
>> (list
>> "DescantMusic"
>> "SopranoMusic"
>> ...
>> "PianoLHMusic"))
>
> Untested:
>
> #(simultaneous-music
> (filter ly:music?
> (map (lambda (x) (ly:parser-lookup parser x))
> (map string->symbol AllMusicNames))))
Thanks David. I must be gaining some small facility
with Scheme now, as I can understand this immediately
and appreciate its elegance! It was using
simultaneous-music that was escaping me, so thanks to
you (and Jan-Peter) for pointing that out to me.
Trevor