Hi Ming,
it can be done:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.19.47"
mel.0 = { <>^\markup{\box\bold"Verse"} g8 8 |}
mel.1 = { c'8. 16~8 b d' c'~8 b~ |}
mel.2 = { b8 a'8~4 r8 g'8 8 8 |}
mel.3 = { f'4. e'8 g' a c'8 16 e'16~ | \break }
mel.4 = { e'8 d'~4~4. g'8 |}
mel.5 = { a'4. g'8 4. e'16 f' |}
mel.6 = { g'8 f'16 g'~8 f' e'4. d'8 |}
mel.7 = { c'4 r16 c'16 a c' a'8 e'16 f'~8 g'~ | \break }
% make a sequence (there's probably a predefined function)
#(define (seq start end)
(cons start
(if (< start end) (seq (1+ start) end) '())))
% display string-version
#(display (string-join (map (lambda (i) (format "\\mel.~A" i)) (seq 0
7)) "\n" 'infix))
{
\partial 4
% produce immediate scheme expression
$(make-music 'SequentialMusic 'elements (map (lambda (i) (assoc-get i
mel)) (seq 0 7)))
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
You can either produce a string containing the needed lilypond code or
you create SimultaneousMusic with a list of the resulting var members.
In your example 'mel' turns out to be an assoc-list with the keys 0..7.
Using map you can produce a list of music expressions.
HTH
Jan-Peter
Am 08.08.2016 um 13:49 schrieb MING TSANG:
Dear lilyponders:
I do not know scheme code. Can scheme code to generate variable series
with leading "\"?
Detail question in the lily file attachment.
Thank you for any help.
Immanuel,
Ming.
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user