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 in Revised(5) Scheme). Otherwise
equivalent to #f
.
If identifier is unbound in the top level environment, then
identifier is define
d 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. defvar
is valid only
when used at top-level.
If identifier is unbound in the top level environment, then
identifier is define
d to the result of evaluating the form
value as if the defconst
form were instead the form
(define identifier value)
. If identifier already has a
value, then value is not evaluated, identifier’s
value is not changed, and an error is signaled. defconst
is
valid only when used at top-level.
The identifiers variable1, variable2, … must be bound either in some region enclosing the ‘set!’ expression or at top level.
<Expression> is evaluated, and the elements of the resulting list are stored in the locations to which each corresponding variable is bound. The result of the ‘set!’ expression is unspecified.
(define x 2) (define y 3) (+ x y) ⇒ 5 (set! (x y) (list 4 5)) ⇒ unspecified (+ x y) ⇒ 9
qase
is an extension of standard Scheme case
: Each
clause of a qase
statement must have as first element a
list containing elements which are:
A qase
statement is equivalent to a case
statement in
which these symbolic constants preceded by commas have been replaced by
the values of the constants, and all symbolic constants preceded by
comma-at-signs have been replaced by the elements of the list values of
the constants. This use of comma, (or, equivalently, unquote
) is
similar to that of quasiquote
except that the unquoted
expressions must be symbolic constants.
Symbolic constants are defined using defconst
, their values are
substituted in the head of each qase
clause during macro
expansion. defconst
constants should be defined before use.
qase
can be substituted for any correct use of case
.
(defconst unit '1) (defconst semivowels '(w y)) (qase (* 2 3) ((2 3 5 7) 'prime) ((,unit 4 6 8 9) 'composite)) ==> composite (qase (car '(c d)) ((a) 'a) ((b) 'b)) ==> unspecified (qase (car '(c d)) ((a e i o u) 'vowel) ((,@semivowels) 'semivowel) (else 'consonant)) ==> consonant