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.
Expands to code that creates an evaluation environment containing all
of the available top-level bindings at the location where
(current-environment)
is used.
Return an empty evaluation environment.
The (hoot interaction-environment)
module provides a simple
environment containing all of Guile’s default bindings.
Return a basic evaluation environment with all of Guile’s default top-level bindings.