Be smarter about capturing the environment for memoized code
* libguile/memoize.h (SCM_M_CAPTURE_MODULE)
* libguile/memoize.c (MAKMEMO_CAPTURE_MODULE, capture_env):
(maybe_makmemo_capture_module, memoize): Determine when to capture the
module on the environment chain at compile-time, instead of at
runtime. Introduces a new memoized expression type, capture-module.
(scm_memoized_expression): Start memoizing with #f as the
environment.
(unmemoize): Add unmemoizer.
(scm_memoize_variable_access_x): Cope with #f as module, and treat as
the root module (captured before modules were booted).
* libguile/eval.c (eval):
* module/ice-9/eval.scm (primitive-eval): Adapt.