[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How does map-some-music work?
From: |
David Kastrup |
Subject: |
Re: How does map-some-music work? |
Date: |
Sat, 11 Oct 2014 16:38:55 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
Jay Vara <address@hidden> writes:
> I am trying to display all the names that appear in a piece of music
> (NoteEvent etc.) using map-some-music. It the function musShow is only
> printing the top level name. What am I missing here?
>
> %%%%%%%%%%%%%%%%%%%%
> \version "2.18.2"
> #(define (showMus music) (display-scheme-music (ly:music-property music
> 'name "Not Defined")))
>
> musShow = #(define-music-function (parser location myx ) (ly:music?)
> (map-some-music
> (lambda (evt) (showMus evt )) myx)
> #{ #})
>
>
> music = {c ~ c}
>
>
> \musShow #music
> %%%%%%%%%%%%%%%%%%%
The return value of map-some-music is interpreted. Anything but #f
stops recursion. A music expression replaces the original. Since you
don't want to change the original music, you probably rather want
for-some-music, and then you'll still need to supply a return value
indicating whether you want to recurse or not.
--
David Kastrup