| Scheme Pretty-Printing |
Scheme is an expression language. This means that everything that is entered to the Scheme interpreter/compiler is an expression. Expressions are separated by blank space (blank, tabs, new-lines). Expressions can be in several forms:
\', such as
"This `\"' is a double-quote"
#' followed by any characters up to
blank space
#, ", \, (, and )
A sequence of Scheme expressions.
The same sequence of expressions, reformatted to make them more readable. The rules you must follow are:
`define' is a define-form. The second sub-expression
will be an identifier and should go on the same line as the word
`define'. If the third (and last) expression is compound it
should start on the following line, indented 3 spaces. Otherwise, the
whole define-form should be on a single line.
`lambda' is a lambda-form. The second sub-expression
will be an identifier or compound expression and should go on the same line as the word
`lambda'. All subsequent expressions should start on a new line,
indented by an additional 3 spaces
`if' is an if-form. The second sub-expression
will be an identifier or compound expression and should go on the same line as the word
`if'. All subsequent expressions should start on a new line,
indented by an additional 4 spaces
(define abc+ (lambda (@1 $f) (if (if
$f a b) (@1
3 4) (bcdefg (d e) (f "g")))))
(define
a 42)
(+ a (- b c))
(define abc+
(lambda (@1 $f)
(if (if $f
a
b)
(@1 3 4)
(bcdefg (d e)
(f "g")))))
(define a 42)
(+ a
(- b c))