[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: When will a #(define ) be executed
From: |
Paul Morris |
Subject: |
Re: When will a #(define ) be executed |
Date: |
Mon, 6 Oct 2014 16:59:16 -0700 (PDT) |
Paul Morris wrote
> I think part of the problem is you haven't actually defined
> keepOriginalBreaks as a function/procedure, but just assigned it a value.
Here's something else that might help clarify why it's not working as you
expected it to:
\version "2.18.2"
origBreak = {}
% LilyPond's "define-music-function" returns a procedure
% here it is assigned to origBreak by Scheme's "define"
#(define origBreak
(define-music-function (parser location)()
#{ \break #}))
#(display origBreak) #(newline)
% -> #<Music function #<procedure #f (parser location)>>
% but Scheme's "define" does not return anything, so if you try this:
#(define keepOriginalBreaks (define something 10))
#(display keepOriginalBreaks) #(newline)
% -> #<unspecified>
#(display something) #(newline)
% -> 10
There would be less room for confusion if "define-music-function" (and its
friends) were named something like "make-music-function" instead.
Cheers,
-Paul
--
View this message in context:
http://lilypond.1069038.n5.nabble.com/When-will-a-define-be-executed-tp167217p167249.html
Sent from the User mailing list archive at Nabble.com.