[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Understanding Lilypond language
From: |
David Kastrup |
Subject: |
Re: Understanding Lilypond language |
Date: |
Sun, 06 Apr 2014 10:18:23 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
Harald Christiansen <address@hidden> writes:
> Hello,
>
> Is there a manual for the lilypond language itself ?
>
> I don't get it ... is it a programming language ... a macro expander ...
> all of the above ?
It is a dynamically typed language. Not much programming in the
language itself, but a Scheme layer caters for that and provides all the
types.
The command line processes an input file, and certain things like
top-level music or scores cause actions.
> I cannot build a mental model of how it works.
>
> For example, let's take variables. I take the notation reference, I look
> at the index and I see several entries.
>
> One entry specifies:
>
> 3.1.5 File structure
> [...]
>
> A variable, such as
>
> foo = { c4 d e d }
>
> So far so good.
>
> Another entry:
>
> 3.3.2 Different editions from one source
> [...]
> Using variables
>
> allLyrics = \lyricmode {King of glo -- ry }
>
> Is this just a macro substitution ?
No. Neither is the above. Both place a sequential music structure into
the respective variables. Use
\void \displayMusic \allLyrics
\void \displayMusic \foo
to see what's in there.
> But then in one of my own I have to declare
>
> myLayout = \layout { <bla bla bla }
>
> even if \myLayout is used inside of a \layout section
Because \layout { ... } is not a music expression but rather an output
definition. Different type.
> So it seems that there is more going on but what ? Are the variables
> typed ? (i.e. myLayout is of type \layout and I have to cast it or
> declare it ? I don't get it)
There are no typed variables. Types are associated with expressions
rather than variables: that's what using a dynamically typed language
like Scheme is about. So there is no point in declaring a variable.
Its type is determined by what you place in there.
> I understand that at some level underneath lilypond uses Scheme
> (Guile) but how specifically ?
>
> e.g.
> \set Staff.printPartCombineTexts = ##f
>
> The way I guess this is: '#f' is the false atom, the first # switches
> to Guile interpretation ... but beyond this all is completely foggy.
Check out the red manual.
<URL:http://lilypond.org/doc/v2.19/Documentation/extending/scheme-in-lilypond>
--
David Kastrup