users may simply choose @q{Run} from the Start menu and enter
@q{guile}.
- Once the guile sandbox is running, you will received a guile prompt:
+ Once the guile sandbox is running, you will receive a guile prompt:
@lisp
guile>
guile>
@end lisp
- Scheme variables can be printed on the display by use of the display function:
+ Scheme variables can be printed on the display by using the display function:
@lisp
guile> (display a)
@end lisp
@noindent
- Note that the value @code{2} and the guile prompt @code{guile} both
- showed up on the same line. This can be avoided by calling the newline
- procedure or displaying a newline character.
+ Note that both the value @code{2} and the guile prompt @code{guile}
+ showed up on the same line. This can be avoided by calling the
+ newline procedure or displaying a newline character.
@lisp
guile> (display a)(newline)
floating point number (a non-integer number).
@item Strings
- Strings are enclosed in double quotes,
+ Strings are enclosed in double quotes:
@example
"this is a string"
There are also compound data types in Scheme. The types commonly used in
LilyPond programming include pairs, lists, alists, and hash tables.
-@unnumberedsubsubsec Pairs
+@subheading Pairs
The foundational compound data type of Scheme is the @code{pair}. As
might be expected from its name, a pair is two values glued together.
Abelson, see
@uref{http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-14.html#footnote_Temp_133}
-
-@unnumberedsubsubsec Lists
+@subheading Lists
A very common Scheme data structure is the @emph{list}. Formally, a
list is defined as either the empty list (represented as @code{'()},
a dialect of lisp, where @q{lisp} is an abbreviation for
@q{List Processing}. Scheme expressions are all lists.
-@unnumberedsubsubsec Association lists (alists)
+@subheading Association lists (alists)
A special type of list is an @emph{association list} or @emph{alist}.
An alist is used to store data for easy retrieval.
Alists are widely used in LilyPond to store properties and other data.
-@unnumberedsubsubsec Hash tables
+@subheading Hash tables
A data structure that is used occasionally in LilyPond. A hash table
is similar to an array, but the indexes to the array can be any type
2.33333333333333
@end lisp
- When the scheme interpreter encounters an expression that is a list, the
- first element of the list is treated as a procedure to be evaluated
- with the arguments of the remainder of the list. Therefore, all operators
- in Scheme are prefix operators.
+ When the scheme interpreter encounters an expression that is a list,
+ the first element of the list is treated as a procedure to be
+ evaluated with the arguments of the remainder of the list. Therefore,
+ all operators in Scheme are prefix operators.
- If the first element of a Scheme expression that is a list passed to the
- interpreter`is @emph{not} an operator or procedure, an error will occur:
+ If the first element of a Scheme expression that is a list passed to
+ the interpreter is @emph{not} an operator or procedure, an error will
+ occur:
@lisp
guile> (1 2 3)
guile>
@end lisp
- Here you can see that the interpreter was trying to treat 1 as an operator
- or procedure, and it couldn't. Hence the error is "Wrong type to apply: 1".
+ Here you can see that the interpreter was trying to treat 1 as an
+ operator or procedure, and it couldn't. Hence the error is "Wrong
+ type to apply: 1".
- To create a list, then , we need to use the list operator, or we need to
+ Therefore, to create a list we need to use the list operator, or to
quote the list so that the interpreter will not try to evaluate it.
@lisp
@node Scheme procedures
@subsection Scheme procedures
- Scheme procedures are executable scheme expressions that return
- a value resulting from their execution., They can also manipulate
+ Scheme procedures are executable scheme expressions that return a
+ value resulting from their execution. They can also manipulate
variables defined outside of the procedure.
-@unnumberedsubsubsec Defining procedures
+@subheading Defining procedures
Procedures are defined in Scheme with define
15/2
@end lisp
-@unnumberedsubsubsec Predicates
+@subheading Predicates
Scheme procedures that return boolean values are often called
@emph{predicates}. By convention (but not necessity), predicate names
#f
@end lisp
-@unnumberedsubsubsec Return values
+@subheading Return values
Sometimes the user would like to have multiple Scheme expressions in
a procedure. There are two ways that multiple expressions can be
@node Scheme conditionals
@subsection Scheme conditionals
-@unnumberedsubsubsec if
+@subheading if
Scheme has an @code{if} procedure:
"a is not greater than b"
@end lisp
-@unnumberedsubsubsec cond
+@subheading cond
Another conditional procedure in scheme is @code{cond}:
TODO -- make this read right
- A similar thing
- happens with variables. After defining a variable
+ A similar thing happens with variables. After defining a variable
@example
twelve = 12
@node LilyPond compound variables
@subsection LilyPond compound variables
-@unnumberedsubsubsec Offsets
+@subheading Offsets
Two-dimensional offsets (X and Y coordinates) as well as object sizes
(intervals with a left and right point) are entered as @code{pairs}. A
TextScript object. These numbers are measured in staff-spaces, so
this command moves the object 1 staff space to the right, and 2 spaces up.
-@unnumberedsubsubsec Extents
+@subheading Extents
todo -- write something about extents
-@unnumberedsubsubsec Property alists
+@subheading Property alists
todo -- write something about property alists
-@unnumberedsubsubsec Alist chains
+@subheading Alist chains
todo -- write something about alist chains
* Adding articulation to notes (example)::
@end menu
-
@node Displaying music expressions
@subsection Displaying music expressions
lilypond file.ly >display.txt
@end example
- With a bit of reformatting, the above information is
- easier to read,
+ With a bit of reformatting, the above information is easier to read,
@example
(make-music 'SequentialMusic