% Thanks to: Dan Eble % Usage: % % aNotes = \relative c' { c1 e1 g1 } % bNotes = \relative c' { } % % \ifThenElse \bNotes \aNotes \bNotes % % Note the test is on emptyness, not definedness. #(define-public (music-empty? m) (let ((void-music (ly:music-property m 'void))) (or (and (not (null? void-music)) void-music) (and (null? (ly:music-property m 'element)) (null? (ly:music-property m 'elements)))))) ifThenElse = #(define-music-function (parser location if-music then-music else-music) (ly:music? ly:music? ly:music?) (if (music-empty? if-music) else-music then-music))