Special Forms

if is a special form, which means that it is evaluated in a special way (the usual way is: evaluate all the arguments first, then call the function).

In the if special form, the test is evaluated first; then only one of the thenform and elseform is evaluated. This allows us to avoid errors that could occur otherwise.


  (if (jester-food? x)
      (write "Yecch!")
      (eat x))

We don't want to eat before testing; the evaluation of if as a special form ensures this.

The function write is called for its side effect (printing) rather than its value.

Contents    Page-10    Prev    Next    Page+10    Index