[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: calling a music variable using a Scheme function
From: |
Nicolas Sceaux |
Subject: |
Re: calling a music variable using a Scheme function |
Date: |
Fri, 24 Jul 2009 10:51:20 +0200 |
Le 24 juil. 09 à 10:37, Valentin Villenave a écrit :
musicOne = { c''' }
musicTwo = { c, }
#(define mylist (list "musicOne" "musicTwo"))
includeList =
#(define-music-function (parser location listname) (string?)
(make-sequential-music (for-each
(lambda (x)
(let ((music (ly:parser-lookup parser (string->symbol x))))
(if (ly:music? music) music)
(make-music 'Music 'void #t)))
'listname)))
{
c \includeList #"mylist"
}
This is not a "mylist" string that you want to pass to your function,
but a list.
And `for-each' does not return a list, you want `map' here.
%% UNTESTED!
includeList =
#(define-music-function (parser location variable-names) (list?)
(make-sequential-music
(map (lambda (variable-name)
(let ((music (ly:parser-lookup parser (string->symbol
variable-name))))
(if (ly:music? music)
music
(make-music 'Music))))
variable-names)))
\includeList #mylist
Nicolas