Wonderful! Thank you very much. It works perfectly.
Is is possible to conditionally execute the #@ expression based on
whether the 'textArray' variable is bound?
I have tried, but I have not succeeded. As a workaround I have defined
an empty 'textArray' in my head.ly which is sometimes redefined by
my-score.ly
On 15/09/2023 17:41, Jean Abou Samra wrote:
Hi,
Try
\version "2.24.2"
textArray = <<
{ \lyricmode { \set stanza = "1" fo -- o bar } }
{ \lyricmode { \set stanza = "2" fo -- o bar } }
\score {
<<
\new Voice = "soprano" { c'1 1 1 }
#@(map (lambda (mus) #{ \new Lyrics { \lyricsto "soprano" { #mus } } #})
(ly:music-property textArray 'elements))
>>
}
You may want to read
https://extending-lilypond.gitlab.io/en/extending/intro.html#inserting-scheme-inside-lilypond
about the #@ operator.
Best
Jean