Typographic Conventions
-
Definition terms are printed in fixed-width bold face:
cents->scaler -
Literals and programming code are printed in fixed-width face:
(list (note 60) (rhythm 'h.)) -
Variables and metavariables (names that stand for pieces of code) are printed in italic face:
number
- Terms separated by | are exclusive choices, that is, exactly one must apply:
number | boolean
-
Braces { } and brackets [ ] are sometimes used to associate or group the enclosed terms. They are never written in actual code.
-
Braces group the enclosed terms into a single entity. Thus:
{number | boolean}
describes single value that is either a number or a boolean.
-
Brackets make the enclosed term optional. An optional term may appear
at most one time. For example, in the following definition:
prob is a required argument that may be followed by up to two optional values. Thus, each of the following calls is correct:(oddsprob [trueval] [falseval])(odds .5) (odds 1 'win) (odds .2 "Yup" "Nope")
-
Braces group the enclosed terms into a single entity. Thus:
-
A star * after a brace means that the enclosed terms may be specified
zero or more times. For example:
means that any number of keyword and value pairs, including none, may follow the required class argument. Each of the following calls is correct:(newclass {keyword value}*)(new midi)
(new midi :time 10)
(new midi :keynum 22 :duration 3) -
A plus + after a brace means that the enclosed terms may be specified one or more times.
-
A sequence of three dots means the rest of the arguments, no matter how many. For example:
means that any number of additional values, including none, may follow arg.(pickarg ...) -
In coding examples evaluation is indicated using the right arrow:
and syntax highlighting distinguishes important syntactic units:⇒keyword string special comment :music"Hello, world"loop;; buggy!