Hello,

>From R6RS Section 10:

  define-syntax form  The expander expands and evaluates the
    right-hand-side expression and binds the keyword to the resulting
    transformer.

Thus I think the following should work:

  (define-syntax +
    (let ((plus +))  ;; `+' should resolve to whatever `+' is bound to
                     ;; before this definition
      (lambda (stx)
        (syntax-case stx ()
          ((_ args ...)
           (apply plus (map syntax->datum #'(args ...))))))))

But it fails when expanding the macro:

  scheme@(guile-user)> (+ 2 3)
  Throw to key `wrong-type-arg':
  ERROR: In procedure vm-debug-engine:
  ERROR: Wrong type to apply: #<syntax-transformer +>

Thoughts?

Thanks,
Ludo’.


Reply via email to