Hello Aaron and Jean,

Many thanks for pointing out the finer points of syntax of Scheme vs.
LilyPond.

I appreciate the Scheme quoting reference, and the syntactic sugar. Still
so much more to learn here!


Many thanks,
mattfong

On Sun, Oct 18, 2020 at 12:58 PM Aaron Hill <lilyp...@hillvisions.com>
wrote:

> On 2020-10-18 12:42 pm, Matthew Fong wrote:
> > Hello everyone,
> >
> > I am having a bit of an issue storing a variable in an alist, and I was
> > wondering if you all could point out what I am doing wrong. If I write
> > the
> > string directly, there's no issue retrieving it ...
> >
> > my-alist = #'((1  . "A") (2 . "B") (3 . "C"))
> > value = #(ly:assoc-get 2 my-alist " error")
> > \markup \value
> >
> > hymnID = "210"
> > hymnMeter = "8.8.8.8"
> > hymnAlist = #'(("ID" . \hymnID ) ("Meter" . \hymnMeter ))
> > hymnValue = #(ly:assoc-get "ID" hymnAlist "error")
> > \markup \hymnValue
>
> Jean already covered the bit about quasi-quoting.
>
> But there is no need to do this as you can store values in an alist
> using dot syntax in LilyPond:
>
> %%%%
> hymn.id = "643"
> hymn.meter = "6 6 11 6 6 11 D"
> \markup #(ly:assoc-get 'id hymn "no value")
> \markup #(ly:assoc-get 'tune hymn "no value")
> %%%%
>
> \hymn automatically is an alist.
>
>
> -- Aaron Hill
>
>

Reply via email to