|
From: | Jean Abou Samra |
Subject: | Re: for-each? |
Date: | Sun, 02 Jul 2023 21:31:12 +0200 |
User-agent: | Evolution 3.48.3 (3.48.3-1.fc38) |
Le dimanche 02 juillet 2023 à 15:05 -0400, Pierre-Luc Gauthier a écrit :
How can I go about using for-each in this example for the group function to accept an arbitrary number of parts ?
You can't — for-each is not the right tool for this. for-each is a purely imperative tool: it runs the same operation on each element of a list, and discards the result. What you actually want is called list splicing:
\version "2.25.6"
parts = #(list
#{ {c'} #}
#{ {d'} #}
#{ {e'} #}
#{ {f'} #} )
group =
#(define-music-function
(parts) (list?)
#{\new StaffGroup << #@parts >>#})
\group \parts
See https://extending-lilypond.gitlab.io/en/extending/intro.html#inserting-scheme-inside-lilypond
Best
Jean
signature.asc
Description: This is a digitally signed message part
[Prev in Thread] | Current Thread | [Next in Thread] |