Hello,

in the snippet below I want to replace, while iterating two lists, the
elements of music1 with the elements of music2.
The code shows how to do that for pitches, but how can I replace the whole
element? (for example, a rest or a note with its articulation)

Thanks


%%%%%%%%

fun = #(define-music-function (parser location music1 music2) (ly:music?
ly:music?)
(let
    (
      (musicList1 (ly:music-property music1 'elements))
      (musicList2 (ly:music-property music2 'elements))
    )
    (map
        (lambda (x y)
          ;iterate notes
          (display "note found\n")
          ;(set! (ly:music-property x 'pitch) #{c'#})
          ;(ly:music-set-property! x 'pitch #{c' #})
          (ly:music-set-property! x 'pitch (ly:music-property y 'pitch))
        )
     musicList1 musicList2
    )
)
#{ $music1 #})

{
\fun {c' d' e'} {f' g' a'}
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to