[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How does \musicMap not return music?
From: |
David Kastrup |
Subject: |
Re: How does \musicMap not return music? |
Date: |
Wed, 18 Jan 2017 21:04:52 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
Simon Albrecht <address@hidden> writes:
> Hello,
>
> surely I overlooked something:
>
> I’m writing a function to truncate MMRs for rehearsal MIDI. This is
> the code so far:
>
> %%%%%%%%%%%%%
> \version "2.19.53"
>
> truncateRests =
> #(define-music-function (mus) (ly:music?)
> (let ((trunc-rests (lambda (e) (if (music-is-of-type? e
> 'multi-measure-rest-event)
> (ly:music-set-property! e
> 'duration (ly:make-duration -1))))))
> (musicMap trunc-rests mus)))
>
> \truncateRests { \time 4/2 R\breve*10 }
> %%%%%%%%%%%%%%
>
> Now Lily complains on that, saying ‘document.ly:9:1: error: music
> function cannot return ##<unspecified>’. I’m puzzled – musicMap is
> itself a music function, so how could truncateRests not return music?
Because trunc-rests doesn't?
Its last expression should be e but instead is
(if ... (ly:music-set ...))
which evaluates to *undefined* .
--
David Kastrup