Environments and evaluation
(null-environment
version
)
r5rs library procedure
If version is equal to 5, corresponding to R5RS, the
null-environment procedure returns a specifier for an environment
that contains only the bindings for all syntactic
keywords defined in the R5RS library. Implementations
must support this value of version.
Implementations may also support other values of version, in which case they return a specifier for an environment containing appropriate bindings corresponding to the speci fied version of the report. If version is neither 5 nor another value supported by the implementation, an error is signaled.
(interaction-environment
)
repl library procedure
This procedure returns a specifier for a mutable environment
that contains an implementation-defined set of bindings,
typically a superset of those exported by (scheme
base). The intent is that this procedure will return the
environment in which the implementation would evaluate
expressions entered by the user into a REPL.
(eval
expr-or-def environment-specifier
)
eval library procedure
If expr-or-def is an expression, it is evaluated in the speci-
fied environment and its values are returned. If it is a defi-
nition, the specified identifier(s) are defined in the specified
environment, provided the environment is not immutable.
(eval '(* 7 3) (environment '(scheme base)))
==> 21
(let ((f (eval '(lambda (f x) (f x x))
(null-environment 5))))
(f + 10))
==> 20
(eval '(define foo 32)
(environment '(scheme base)))
==> error is signaled
|