Is it possible to use externally defined functions inside a macro definition? For example, one might want to use srfi-1 utilities to manipulate expressions as follows.
(load "srfi-1")
(define-macro (silly vars . body) (let ((vals (iota (length vars)))) `(let ,(zip vars vals) ,@body)))
(silly (foo bar baz) (pp bar))
which should expand to
(let ((foo 0) (bar 1) (baz 2)) (pp foo))
This doesn't work because macro expansion happens before srfi-1 is loaded. Bummer.
I imagine that one will be able to do this in the next release (it causes a segfault right now), but is there a better way?
(define-macro (silly vars . body) (include "srfi-1.scm") (let ((vals (iota (length vars)))) `(let ,(zip vars vals) ,@body)))
Regards,
Ben