Previous: expander utils compar, Up: expander utils [Index]
The following bindings are exported by the library (vicare
expander).
Interface to the internal expression expander, it is the expansion
engine used by R6RS’s eval function.
sexp must be a symbolic expression representing a Scheme form; env must be an evaluation environment.
Return two values: the result of the expansion as symbolic expression in the core language; a list of libraries that must be invoked before evaluating the returned expression.
Example:
(import (vicare)
(prefix (vicare expander) xp::))
(receive (code libs)
(xp::expand-form-to-core-language
'(define (doit x)
(if (null? x)
#f
(doit (cdr x))))
(environment '(vicare)))
code)
⇒ (set! loc.doit
(annotated-case-lambda doit
((lex.x)
(if (annotated-call (null? x)
(primitive null?) lex.x)
'#f
(annotated-call (doit (cdr x))
loc.doit
(annotated-call (cdr x) (primitive cdr) lex.x))))))