Discussion:
alist problem
David Sumbler
2018-12-05 14:17:50 UTC
Permalink
IR 2.19.82 shows the following amongst the settings for TrillSpanner:

bound-details (list):
'((left (text #<procedure musicglyph-markup (layout props glyph-name)>
"scripts.trill")
(Y . 0)
(stencil-offset -0.5 . -1)
(padding . 0.5)
(attach-dir . 0))
(left-broken (end-on-note . #t))
(right (Y . 0)))

If I write

\override TrillSpanner.bound-details.left-broken = #'(end-on-note . #t)

Lilypond accepts it, suggesting that I am using the correct syntax.

But if I write

\override TrillSpanner.bound-details.right = #'(Y . 0)

Lilypond produces:

ERROR: Wrong type argument in position 2 (expecting association list):
(Y . 0)

I can't figure out why this is. Can somebody please explain it to me,
and show me the correct syntax?

(The reason for doing this was to try to shorten the extent of a trill
spanner. This may not be the correct parameter to change, which is why
I was trying different values; but even if that is true, I would still
like to know why my line produces an error.)

David
David Kastrup
2018-12-05 14:37:21 UTC
Permalink
Post by David Sumbler
'((left (text #<procedure musicglyph-markup (layout props glyph-name)>
"scripts.trill")
(Y . 0)
(stencil-offset -0.5 . -1)
(padding . 0.5)
(attach-dir . 0))
(left-broken (end-on-note . #t))
(right (Y . 0)))
If I write
\override TrillSpanner.bound-details.left-broken = #'(end-on-note . #t)
Lilypond accepts it, suggesting that I am using the correct syntax.
You aren't. You are putting a pair where an association list should
be. This would need to be

\override TrillSpanner.bound-details.left-broken = #'((end-on-note . #t))

to have the same effect.
Post by David Sumbler
But if I write
\override TrillSpanner.bound-details.right = #'(Y . 0)
(Y . 0)
I can't figure out why this is. Can somebody please explain it to me,
and show me the correct syntax?
(Y . 0) is a pair, not an association list. To get the same effect,
you'd need to write

\override TrillSpanner.bound-details.right = #'((Y . 0))

or alternatively (assuming you want other right bound-details to stay)

\override TrillSpanner.bound-details.right.Y = 0
Post by David Sumbler
(The reason for doing this was to try to shorten the extent of a trill
spanner. This may not be the correct parameter to change, which is
why I was trying different values; but even if that is true, I would
still like to know why my line produces an error.)
Because you cannot add or delete parens at will. Note that
(right (Y . 0)) is a shorthand for (right . ((Y . 0))) . It is easy to
overlook this when looking at a pair (like the key-value pair of an
association list) where the cdr is a list in itself. In that case, the
Scheme printer elides the dot and one level of parens around the cdr,
simply because a list is indistinguishable from a dotted list where the
cdr is a list itself.
--
David Kastrup
David Sumbler
2018-12-05 16:55:53 UTC
Permalink
-----Original Message-----
From: David Kastrup <***@gnu.org>
To: David Sumbler <***@aeolia.co.uk>
CC: lilypond-***@gnu.org
Subject: Re: alist problem
Date: Wed, 05 Dec 2018 15:37:21 +0100
Post by David Sumbler
'((left (text #<procedure musicglyph-markup (layout props glyph-
name)>
"scripts.trill")
(Y . 0)
(stencil-offset -0.5 . -1)
(padding . 0.5)
(attach-dir . 0))
(left-broken (end-on-note . #t))
(right (Y . 0)))
If I write
\override TrillSpanner.bound-details.left-broken = #'(end-on-note . #t)
Lilypond accepts it, suggesting that I am using the correct syntax.
You aren't. You are putting a pair where an association list should
be. This would need to be

\override TrillSpanner.bound-details.left-broken = #'((end-on-note .
#t))

to have the same effect.
Post by David Sumbler
But if I write
\override TrillSpanner.bound-details.right = #'(Y . 0)
(Y . 0)
I can't figure out why this is. Can somebody please explain it to me,
and show me the correct syntax?
(Y . 0) is a pair, not an association list. To get the same effect,
you'd need to write

\override TrillSpanner.bound-details.right = #'((Y . 0))

or alternatively (assuming you want other right bound-details to stay)

\override TrillSpanner.bound-details.right.Y = 0
Post by David Sumbler
(The reason for doing this was to try to shorten the extent of a trill
spanner. This may not be the correct parameter to change, which is
why I was trying different values; but even if that is true, I would
still like to know why my line produces an error.)
Because you cannot add or delete parens at will. Note that
(right (Y . 0)) is a shorthand for (right . ((Y . 0))) . It is easy to
overlook this when looking at a pair (like the key-value pair of an
association list) where the cdr is a list in itself. In that case, the
Scheme printer elides the dot and one level of parens around the cdr,
simply because a list is indistinguishable from a dotted list where the
cdr is a list itself.

------------------------

Now that you have explained it I feel that I should have been able to
work that out for myself. But I'm afraid I didn't.

So thank you very much for sorting it out for me.

David

Loading...