PREV UP NEXT SCM

4.8: Syntax Extensions

procedure: procedure-documentation proc
Returns the documentation string of proc if it exists, or #f if not.

If the body of a lambda (or the definition of a procedure) has more than one expression, and the first expression (preceeding any internal definitions) is a string, then that string is the documentation string of that procedure.

(procedure-documentation (lambda (x) "Identity" x)) => "Identity"
(define (square x)
    "Return the square of X."
    (* x x))
=> #<unspecified>
(procedure-documentation square) => "Return the square of X."
Read syntax: #. expression
Is read as the object resulting from the evaluation of expression. This substitution occurs even inside quoted structure.

In order to allow compiled code to work with #. it is good practice to define those symbols used inside of expression with #.(define ...). For example:

#.(define foo 9)                        => #<unspecified>
'(#.foo #.(+ foo foo))                  => (9 18)
Read syntax: #+ feature form
If feature is provided? (by *features*) then form is read as a scheme expression. If not, then form is treated as whitespace.

Feature is a boolean expression composed of symbols and and, or, and not of boolean expressions.

For more information on provided? and *features*, See Require.

Read syntax: #- feature form
is equivalent to #+(not feature) expression.
Read syntax: #' form
is equivalent to form (for compatibility with common-lisp).
Read syntax: #| any thing |#
Is a balanced comment. Everything up to the matching |# is ignored by the read. Nested #|...|# can occur inside any thing.

A similar read syntax #! (exclamation rather than vertical bar) is supported for Posix shell-scripts (see Shell Scripts).

Special Form: defined? symbol
Equivalent to #t if symbol is a syntactic keyword (such as if) or a symbol with a value in the top level environment (see Variables and regions). Otherwise equivalent to #f.
Special Form: defvar identifier initial-value
If identifier is unbound in the top level environment, then identifier is defined to the result of evaluating the form initial-value as if the defvar form were instead the form (define identifier initial-value) . If identifier already has a value, then initial-value is not evaluated and identifier's value is not changed.

SCM also supports the following constructs from Common Lisp: defmacro, macroexpand, macroexpand-1, and gentemp. See Defmacro.