lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why are variables received by #(define-music-function) unbound in #{ #(s


From: Marcus Macauley
Subject: Why are variables received by #(define-music-function) unbound in #{ #(scheme code here?) #}
Date: Sun, 15 Oct 2006 23:04:29 -0400
User-agent: Opera Mail/9.00 (Linux)

Either I've found a bug, or (more likely) I don't understand how variables are passed between Lilypond and Scheme.

Below is an example, where a #(define-music-function...) block receives a variable, stringone. That variable seems to be accessible (i.e. bound, if I have my terminology straight) in two places, but not accesible (i.e. unbound) in the third place.

1. Accesible by Scheme code within #(define-music-function) but outside of #{ #} block
2. Accessible by Lilypond input within #{ #} block
3. Not accesible by Scheme code within #{ #} block

Why is this, and is there any way to pass a variable, received by define-music-function, to Scheme code within the #{ #} block?

Thanks in advance,
Marcus



\version "2.9.23"

function = #(define-music-function
              (parser location stringone)
              (string?)
              (let ((stringone (string-append stringone " foo")))
                   #{
% uncommenting the following line yields "ERROR: Unbound variable: stringone"
%                        #(string-append stringone " bar")
                        c1^\markup { $stringone }
                   #}))

\relative c'' { \function #"one" }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]