|
From: | Gianmaria Lari |
Subject: | Re: simple scheme in lilypond |
Date: | Wed, 28 Nov 2018 08:47:41 +0100 |
Hello,
the $ sign has a special meaning of "instant scheme-_expression_". An
instant scheme _expression_ is evaluated instantly *and* the result is
observed so that lilypond can decide what to do with it. When lily
receives something that can be treated as a markup from an instant
scheme _expression_ it is handled like \markup {}. But a pure string is
not a core lily-_expression_ like music or markup. Thats the reason (3)
fails with an error. The result of a plain scheme-exression introduced
with # is simply ignored in root context.
HTH
Jan-Peter
Am 27.11.18 um 09:14 schrieb Gianmaria Lari:
> Probably these are very trivial things. Sorry to ask them but would like
> to understand.
>
> If I write (1):
>
>
> \version "2.19.82"
> $(object->string (+ 3 2))
>
>
> Lilypond is happy and compile to a pdf file showing "5".
>
> Even this simpler code works... (2)
>
> \version "2.19.82"
> $"Hello"
>
>
> and generate a pdf file showing "Hello".
>
> It is clear to me that $ introduce a scheme _expression_ that is
> evaluated. And in the previous two examples the scheme code is evaluated
> to strings. But I don't understand why lilypond outputs them. If I write
> (3):
>
> \version "2.19.82"
> "Test"
>
>
> this does not compile. So I would think that the "correct" code to
> output evaluated _expression_ in the pdf file should be (4)
>
>
> \version "2.19.82"
> \markup $(object->string (+ 3 2))
>
>
> or this (5)
>
> \version "2.19.82"
> \markup $"Hello"
>
>
> Why the behaviour of (1) and (2) ?
>
> * * *
>
> I tried to rewrite (1) and (2) with the hash mark instead of dollar (6):
>
> \version "2.19.82"
> #(object->string (+ 3 2))
>
>
> and (7):
>
> \version "2.19.82"
> #"Hello"
>
>
> This time, there is no output in the pdf file. Why this difference?
>
> Thank you, g.
>
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user
[Prev in Thread] | Current Thread | [Next in Thread] |