[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
referencing hash key with music symbol
From: |
Jeffery Shivers |
Subject: |
referencing hash key with music symbol |
Date: |
Sat, 9 Jul 2016 04:37:19 -0400 |
Hi LP team,
I am working on automating editorial commands with ScholarLY, and I am
having some trouble pulling a music function that is stored in a hash
table. If I make a table and assign a key 'Slur to slurDashed, I can use it
successfully in the following example:
#(define mytable (make-hash-table))
#(hash-set! mytable 'Slur slurDashed)
\score {
\new Staff {
#(let ((func (hash-ref mytable 'Slur)))
#{
#func f'( g')
#})
}
}
In that context, "Slur" is of course an arbitrary name. However, when a
symbol is used to indicate what item is being annotated in scholarly, e.g.:
\criticalRemark \with {
message = "my message"
apply = addition
} Slur f'( g') % <<<< "Slur" indicated here
... we will use that symbol to determine what function, previously assigned
to the so-named key in the hash table, to apply to the music. However, when
I attempt to do this, Lily (or maybe Guile) doesn't cooperate. I don't have
a very useful way of minimizing this process, since it takes place in one
of the larger chunks of the library's code, but basically `item` is the
argument that the symbol satisfies, and in (sort of) context, the
unsuccessful use of it looks like:
... (let ((func (hash-ref mytable item))) ...
Replacing "item" with 'Slur works like a charm - `func` applies a dashed
slur in a lilypond code block in the local scope. But I can't seem to work
out why using the symbol name doesn't also work.
Hopefully I've explained the issue clearly enough, and I apologize for the
lack of a better non-working example. Any help is very much appreciated.
Best,
Jeffery
- referencing hash key with music symbol,
Jeffery Shivers <=