Hi Trevor, I compiled a short example, that should give you some hints.
HTH Jan-Peter Am 01.04.2015 um 13:18 schrieb Trevor Daniels:
Hi Schemers 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")) TIA Trevor _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
\version "2.18.2" % a list of needed var names as symbol-list AllMusicNames = #'(DescantMusic SopranoMusic PianoLHMusic) % define AllMusic as music function - to be called with \AllMusic AllMusic = #(define-music-function (parser location)() (make-music 'SimultaneousMusic 'elements (map (lambda (n) (let ((mus (ly:parser-lookup parser n))) ; get the object with the name n or an empty list (if (ly:music? mus) ; if mus is music, return it, otherwise return void-music mus (make-music 'SequentialMusic 'void #t)) )) AllMusicNames)) ) DescantMusic = \relative c'' { ees4 e f fis } SopranoMusic = \relative c'' { bes4 a c b } \AllMusic
_______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel