[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scm functions scope and arguments
From: |
VSD |
Subject: |
scm functions scope and arguments |
Date: |
Fri, 24 Jun 2005 13:50:35 +0200 |
User-agent: |
Opera M2/8.01 (Win32, build 7642) |
Hi,
I've made a set of scheme functions to simplify the use of custom fret
diagrams in scores. Here is a sample file of how it works:
%%%%%%%%% start of sample file
\version "2.5.31" % Win XP
#(def-markup-command (E-one layout props arg) (markup?)
(let
(
(definition-list
(fret-parse-definition-string
(cons '((thickness . 0.8) (size . 1.05)) props)
"h:3;f:1;6-o;5-2-2;4-2-3;3-1-1;2-o;1-o;"
)
)
)
(make-fret-diagram layout (car definition-list) (cdr definition-list)))
)
\score
{
\new Staff
{
a4^\markup \E-one "" b c d
}
}
%%%%%%%% EOF
This code works fine as long as E-one is defined inside the file
"fret-diagrams.scm" (without the starting "#"). But if I define it outside
that file (e.g. in the calling ly file as in the given example), then
lilypond complains:
"ERROR: Unbound variable: fret-parse-definition-string"
It somehow doesn't find the definition of this function (which is defined
inside "fret-diagrams.scm" too).
Does anybody know how to succesfully define and use the function E-one
outside "fret-diagrams.scm", e.g. inside an auxiliary private file named
"fret-diag-utils.scm"?
This way I wouldn't need to "dirty" the installed "fret-diagrams.scm"
file, so I wouldn't have to update it after each intermediate lilypond
upgrade.
Yet one more thing: How could I define the E-one function so it takes no
arguments?
I've tried
#(def-markup-command (E-one layout props)
(...)
)
but this doesn't work:
"ERROR: In procedure memoization:
ERROR: Missing expression in (define-private (E-one-markup layout props))"
The goal is to call \E-one instead of \E-one ""
Any hints appreciated. Thanks in advance,
Vincent
- scm functions scope and arguments,
VSD <=