Every REPL has a current environment, which is the place
where expressions are evaluated and definitions are stored. When Scheme
is started, this environment is the value of the variable
user-initial-environment. There are a number of other
environments in the system, for example
system-global-environment, where the runtime system's bindings
You can get the current REPL environment by evaluating
There are several other ways to obtain environments. For example, if you have a procedure object, you can get a pointer to the environment in which it was closed by evaluating
Here is the procedure that changes the REPL's environment:
Changes the current REPL environment to be environment (
gestands for “Goto Environment”). Environment is allowed to be a procedure as well as an environment object. If it is a procedure, then the closing environment of that procedure is used in its place.
This procedure is useful for finding out which environment you are in (
pestands for “Print Environment”). If the current REPL environment belongs to a package, then
pereturns the package name (a list of symbols). If the current REPL environment does not belong to a package then the environment is returned.