Lukas-Fabian Moser <l...@gmx.de> writes:

> Elaborating on David's explanation, it might be instructive to study the
> output of:
>
> \version "2.25.9"
>
> mappingFunction =
> #(define-music-function (music) (ly:music?)
>    (music-map
>     (lambda (m)
>       (ly:message "Considering music:\n~a\n---------\n"
>                   ((@@ (lily) music->lily-string) m))
>       m)
>     music))
>
> \mappingFunction
> \new PianoStaff
> <<
>   \new Staff \relative { c'4 d e c }
>   \new Staff \relative { c' g c c }
>>>

If you don't want to call upon undocumented internals of LilyPond (the
(@@ (lily) ...) bit), you can just use

\version "2.25.9"

mappingFunction =
#(define-music-function (music) (ly:music?)
   (music-map
    (lambda (m)
     (ly:message "Considering music:~a---------\n"
      (with-output-to-string (lambda () (displayLilyMusic m))))
      m)
    music))

\mappingFunction
\new PianoStaff
<<
  \new Staff \relative { c'4 d e c }
  \new Staff \relative { c' g c c }
>>

-- 
David Kastrup

Reply via email to