[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: simple scheme in lilypond
From: |
Jan-Peter Voigt |
Subject: |
Re: simple scheme in lilypond |
Date: |
Tue, 27 Nov 2018 11:47:46 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 |
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
>