[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: map-some-music question
From: |
Paul Morris |
Subject: |
Re: map-some-music question |
Date: |
Mon, 6 Oct 2014 17:33:34 -0700 (PDT) |
Jay Vara wrote
> I am trying to display all the names that appear in a piece of music
> (NoteEvent etc.) using map-some-music. It the function musNam is only
> printing the top level name. What am I missing here?
Hi Jay, From music-functions.scm:
-----------
(define-public (map-some-music map? music)
"Walk through @var{music}, transform all elements calling @var{map?}
and only recurse if this returns @code{#f}. @code{elements} or
@code{articulations} that are not music expressions are discarded:
this allows some amount of filtering.
-----------
So the following does what you want because the lambda returns #f
You may also want to look at "music-map", also defined in
music-functions.scm.
HTH,
-Paul
\version "2.18.2"
#(define (name-of music) (display-scheme-music (ly:music-property music
'name)))
musNam = #(define-music-function (parser location myx) (ly:music?)
(map-some-music
(lambda (evt) (name-of evt) #f)
myx)
#{ #})
music = {c ~ c}
\musNam #music
--
View this message in context:
http://lilypond.1069038.n5.nabble.com/map-some-music-question-tp167241p167250.html
Sent from the User mailing list archive at Nabble.com.