Extending LilyPond: 1.2.1 LilyPond Scheme syntax

### 1.2.1 LilyPond Scheme syntax

The Guile interpreter is part of LilyPond, which means that Scheme can be included in LilyPond input files. The hash mark `#` is used to tell the LilyPond parser that the next value is a Scheme value.

Once the parser sees a hash mark, input is passed to the Guile interpreter to evaluate the Scheme expression. The interpreter continues to process input until the end of a Scheme expression is seen.

Scheme procedures can be defined in LilyPond input files:

>     #(define (average a b c) (/ (+ a b c) 3))

Note that LilyPond comments (`%` and `%{ %}`) cannot be used within Scheme code, even in a LilyPond input file, because the Guile interpreter, not the LilyPond parser, is interpreting the Scheme expression. Comments in Guile Scheme are entered as follows:

>     ; this is a single-line comment

>     #!
>       This a (non-nestable) Guile-style block comment
>       But these are rarely used by Schemers and never in
>       LilyPond source code
>     !#

For the rest of this section, we will assume that the data is entered in a music file, so we add `#`s at the beginning of each Scheme expression.

All of the top-level Scheme expressions in a LilyPond input file can be combined into a single Scheme expression by the use of the `begin` statement:

>     #(begin
>       (define foo 0)
>       (define bar 1))

Jiné jazyky: deutsch, español.

#### LilyPond — Extending