diff options
Diffstat (limited to 'lang/elisp/transform.scm')
-rw-r--r-- | lang/elisp/transform.scm | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/lang/elisp/transform.scm b/lang/elisp/transform.scm index ee288a722..09159c073 100644 --- a/lang/elisp/transform.scm +++ b/lang/elisp/transform.scm @@ -1,4 +1,5 @@ (define-module (lang elisp transform) + #:use-syntax (lang elisp expand) #:use-module (lang elisp internals trace) #:use-module (lang elisp internals fset) #:use-module (lang elisp internals evaluation) @@ -26,23 +27,27 @@ (define (syntax-error x) (error "Syntax error in expression" x)) -(define-macro (scheme exp . module) - (let ((m (if (null? module) - the-root-module - (save-module-excursion - (lambda () - ;; In order for `resolve-module' to work as - ;; expected, the current module must contain the - ;; `app' variable. This is not true for #:pure - ;; modules, specifically (lang elisp base). So, - ;; switch to the root module (guile) before calling - ;; resolve-module. - (set-current-module the-root-module) - (resolve-module (car module))))))) - (let ((x `(,eval (,quote ,exp) ,m))) - ;;(write x) - ;;(newline) - x))) +(define scheme + (procedure->memoizing-macro + (lambda (exp env) + (let ((exp (cadr exp)) + (module (cddr exp))) + (let ((m (if (null? module) + the-root-module + (save-module-excursion + (lambda () + ;; In order for `resolve-module' to work as + ;; expected, the current module must contain the + ;; `app' variable. This is not true for #:pure + ;; modules, specifically (lang elisp base). So, + ;; switch to the root module (guile) before calling + ;; resolve-module. + (set-current-module the-root-module) + (resolve-module (car module))))))) + (let ((x `(,eval (,quote ,exp) ,m))) + ;;(write x) + ;;(newline) + x)))))) (define (transformer x) (cond ((pair? x) |