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

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to