Previous: REPL Environment, Up: Environments [Contents][Index]
The operations in this section manipulate top-level environments, as opposed to environments created by the application of procedures. For historical reasons, top-level environments are referred to as interpreter environments.
Returns the current environment. This form may only be evaluated in a top-level environment. An error is signalled if it appears elsewhere.
Returns #t
if object is an top-level environment; otherwise
returns #f
.
interpreter-environment?
is an alias for
top-level-environment?
.
Returns a newly allocated top-level environment.
extend-top-level-environment
creates an environment that has
parent environment, make-top-level-environment
creates an
environment that has parent system-global-environment
, and
make-root-top-level-environment
creates an environment that has
no parent.
The optional arguments names and values are used to specify initial bindings in the new environment. If specified, names must be a list of symbols, and values must be a list of objects. If only names is specified, each name in names will be bound in the environment, but unassigned. If names and values are both specified, they must be the same length, and each name in names will be bound to the corresponding value in values. If neither names nor values is specified, the environment will have no initial bindings.
Defines symbol1 in environment1 to have the same binding as symbol2 in environment2, and returns an unspecified value. Prior to the call, symbol2 must be bound in environment2, but the type of binding is irrelevant; it may be a normal binding, an unassigned binding, or a keyword binding. Signals an error if symbol1 isn’t definable in environment1, or if symbol2 is unbound in environment2.
By “the same binding”, we mean that the value cell is shared between the two environments. If a value is assigned to symbol1 in environment1, a subsequent reference to symbol2 in environment2 will see that value, and vice versa.
If symbol is bound in environment or one of its ancestor
environments, removes the binding, so that subsequent accesses to that
symbol behave as if the binding never existed. Returns #t
if there
was a binding prior to the call, and #f
if there wasn’t.
Previous: REPL Environment, Up: Environments [Contents][Index]