alist problem

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

alist problem

David Sumbler
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





_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: alist problem

David Kastrup
David Sumbler <[hidden email]> writes:

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

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.

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

(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

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

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: alist problem

David Sumbler

-----Original Message-----
From: David Kastrup <[hidden email]>
To: David Sumbler <[hidden email]>
CC: [hidden email]
Subject: Re: alist problem
Date: Wed, 05 Dec 2018 15:37:21 +0100

David Sumbler <[hidden email]> writes:

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

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.

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

(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

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


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user