|
Practical Common LispThe rule for IF is pretty easy: evaluate the first expression. If it evaluates to non-NIL, then evaluate the next expression and return its value. Otherwise, return the value of evaluating the third expression or NIL if the third expression is omitted. In other words, the basic form of an IF expression is as follows: (if test-form then-form [ else-form ]) The test-form will always be evaluated and then one or the other of the then-form or else-form. An even simpler special operator is QUOTE, which takes a single expression as its "argument" and simply returns it, unevaluated. For instance, the following evaluates to the list (+ 1 2), not the value 3: (quote (+ 1 2)) There's nothing special about this list; you can manipulate it just like any list you could create with the LIST function.[49] QUOTE is used commonly enough that a special syntax for it is built into the reader. Instead of writing the following: (quote (+ 1 2)) you can write this: '(+ 1 2) This syntax is a small extension of the s-expression syntax understood by the reader ...» | Код для вставки книги в блог HTML
phpBB
текст
|
|