Next: syntaxes, Previous: simple-match, Up: lang [Index]
The library (vicare language-extensions variables) provides a
way to define simple storage locations similar to the variables used in
many languages. The variable type is disjoint from the other
types.
The following bindings are exported by the library (vicare
language-extensions variables); the bindings whose name is prefixed with
$ are unsafe operations: they do not validate their
arguments before accessing them.
Build and return a new variable object. The
variable is initialised to obj, which defaults to the
return value of (void).
Return #t if obj is a variable object, else return
#f.
Setter and getter for the value of variable objects.
Like define, but store the value in a newly built
variable object, which is then bound to ?name. Example:
(import (vicare) (vicare language-extensions variables)) (define-variable v 123) v ⇒ 123 (set! v 456) v ⇒ 456
While define defines a binding which, when exported by a library,
cannot be modified, define-variable allocates a storage location,
so the value bound to ?name can be modified at will.
Like the second form of define-variable, but accept as second
argument an expression which, when evaluated, returns a
variable object.