## Module (scheme eval)

This module provides R7RS procedures to evaluate expressions dynamically.

### environment

environment LIST ...procedure

  This procedure returns a specifier for the environment that results by starting with an empty environment and then importing each list, considered as an import set, into it. (See section 5.6 of R7RS for a description of import sets.) The bindings of the environment represented by the specifier are immutable, as is the environment itself.

### eval

eval EXPR-OR-DEF #!optional ENVIRONMENT-SPECIFIER procedure

  If EXPR-OR-DEF is an expression, it is evaluated in the specified environment and its values are returned. If it is a definition, the specified identifier(s) are defined in the specified environment, provided the environment is not immutable.

  The ENVIRONMENT-SPECIFIER is optional, and if not provided it defaults to the value of `(interaction-environment)`. This is a CHICKEN extension to R7RS, which, though strictly nonportable, is very common among Scheme implementations.

      (eval '(* 7 3) (environment '(scheme base)))
          ==> 21

      (let ((f (eval '(lambda (f x) (f x x))
                     (null-environment 5))))
        (f + 10))
          ==> 20

Previous: Module (scheme file)

Next: Module (scheme inexact)