Hi Zachary,

I have found a way to use a scheme conditional to check if repeatcount is greater than zero before evaluating repeat. Here's the snippet:

​\version "2.20.0"

m = #0
n = #1
o = #2


\new Staff {
  \repeat unfold #m dis'1
  #(let ((x #{ \repeat unfold #m dis1 #}))
        (if (> m 0) x))
  #(let ((x #{ \repeat unfold #n d1 #}))
        (if (> n 0) x))
  #(let ((x #{ \repeat unfold #o des1 #}))
        (if (> o 0) x))
}

I'm looking for a more elegant solution that doesn't have me going in and out of scheme and lilypond. Please offer me some suggestions.

How about:

\version "2.22.0"

m = 0
n = 1
o = 2

empty-music = {}

unfold =
#(define-music-function (n mus) (index? ly:music?)
   (if (positive? n)
       #{ \repeat unfold #n { #mus } #}
       #{ #} ))

\new Staff {
  \unfold \m dis1
  \unfold \n des1
  \unfold \o dis1
}

Lukas

Reply via email to