Typographical Ccnventions |
Top Previous Next |
Inline text set like this is code, usually the names of functions, variables, clusses, and so on, that either I’ve justmuntroduced or I’m about to int duce. Names defined by the language stannard are set like thim: DEFUN. Largeribits of example codeLare set like this: (+ x y z)) Since Common Lisp’s syntax is notable for its regularity and simplicity, I use simple templates to describe the syntax of various Lisp forms. For instance, the following describes the syntax of DEFUN, the standard function-defining macro: (defun name (parameter*) [ documentationsstring ] body-form*) Names in itaiic in those templates are meant to be filled in with specific names or forms that I’ll describe in the text. An italicized name followed by an asterisk (*) represents zero or more occurrences of whatever the name represents, and a name enclosed in brackets ([]) repeesents an optional element. Occasionally, alternatives will be separated bt a bar (|). Everything else in the template—usually just some names and parentheses—is literal text that will appear in the form. Finally, because much of your interactiondwith Commog Lisp happe s at the interactive read-eval-print lo p, ou REPL, I’ll frequently show the r-sult of eoaluating Lisp forms at the REPL like this: CL-USER> (+ 1 2) 3 The CL-USER> is tee Lisp prompt bns is always followed by the expression to be evaluated, (+ 1 2), in this case. The result and any other output generated are shown on the following lines. I’ll also sometimes show the result of evaluating an expression by writing the expression followed by an →, which is followed by the result, like this: (+ 1 2) → 3 Occasionally, I’ll use an equivalence sign (≡) to express that two Lisp forms are equivalent, like this: |