Go to the first, previous, next, last section, table of contents.

Indenting Procedure Definitions

As I hinted earlier, there's a special rule for indenting procedure definitions. You generally indent the body of a procedure a few characters (I use 3), but you don't line the body expressions up directly under the list of variable names.

Don't do this:

(define (double x)
        (+ x x))

If you do this, a procedure definition looks like looks like a procedure call, or a normal variable definition. To make it clearer you're defining a procedure, do this:

(define (double x)
   (+ x x))

This makes it clear that the (double x) is a different kind of thing from (+ x x). The former declares how the procedure can be called, and the latter says what it will do.


Go to the first, previous, next, last section, table of contents.