[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Can't use direction names in (case)
From: |
David Kastrup |
Subject: |
Re: Can't use direction names in (case) |
Date: |
Sun, 12 Jun 2022 13:29:39 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Dan Eble <dan@lyric.works> writes:
> This not do what I intended:
>
> ```
> (case (ly:item-break-dir grob)
> ((LEFT) (ly:grob-property grob 'glyph-left))
> ((RIGHT) (ly:grob-property grob 'glyph-right))
> (else (ly:grob-property grob 'glyph))))
> ```
>
> This does:
>
> ```
> (case (ly:item-break-dir grob)
> ((-1) (ly:grob-property grob 'glyph-left))
> ((1) (ly:grob-property grob 'glyph-right))
> (else (ly:grob-property grob 'glyph))))
> ```
>
> Why?
Because case does not evaluate the tag lists, so you are comparing with
the symbol LEFT rather than the value -1 in the first case. Also it
uses eqv? so it doesn't work for strings, not even literal ones.
It's a syntax construct that is less useful than it looks at first sight.
--
David Kastrup