[Top][All Lists]

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

Re: referencing hash key with music symbol

From: David Kastrup
Subject: Re: referencing hash key with music symbol
Date: Sat, 09 Jul 2016 12:55:34 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Jeffery Shivers <address@hidden> writes:

> 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')
>             #})
>     }
> }

Are you sure this works?

> 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,

Nevertheless, "Lily (or maybe Guile) doesn't cooperate" is an entirely
useless problem description.  Even if you feel you can't minimize the
process for whatever reason, not even bothering to mention the error
message (or the definition of \criticalRemark or at least its function
signature if nothing else) makes this a completely useless report.

> 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,

"argument that the symbol satisfies" is gibberish.  If you feel you
cannot provide actual code, the description has to be a lot more precise
if it is supposed to give a clue about the problem.

One important point about wanting to have a minimal example provided is
that computers don't take hand-waving, so the minimal example tends to
clear up a lot of language ambiguity even when the description (or
guesses about the problem) are inscrutable.  Without a minimal example,
you need to invest more effort into accuracy of language for the sake of
the reader, and "the reader" is in itself a fuzzy target since they vary
more than LilyPond from 2.12 to 2.19.  So you better err on the better
side of well-defined language.

> 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.

It would.  But all we have is your word that `item' is set to the symbol
'Slur.  And when LilyPond's opinion conflicts with that, your opinion
does not carry the day when you want LilyPond to act on it.

David Kastrup

reply via email to

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