Next: Fibers, Previous: Foreign function interface, Up: Scheme reference [Contents][Index]
Hoot is an ahead-of-time, whole-program compiler, but what if we want
to evaluate arbitrary Scheme code at runtime? Fortunately, the
(hoot eval
) module provides a Scheme interpreter for this
purpose!
Evaluation happens in the context of an environment. Here’s a simple example:
(use-modules (hoot eval) (hoot interaction-environment)) (eval '(let ((x 1) (y 2)) (+ x y)) (interaction-environment))
Evaluate exp
in the context of the environment
toplevel-env.
The (hoot interaction-environment)
module provides a way to
capture the compile-time environment as an environment that can be
used by eval
.
Return an evaluation environment containing all of the bindings in the current module.