[gambit-list] help with port from DrScheme?

David Van Horn dvanhorn at cs.uvm.edu
Mon Oct 18 00:26:34 EDT 2004

Bill Richter wrote:
> Has anyone worked out ports of various DrScheme things, such as the
> local construction?

Here is a syntax-rules macro for local:

(define-syntax local
  (syntax-rules (define)
    ((local defs . body)
         ((rev (syntax-rules ()
                 ((rev accum (x . rest) b) (rev (x . accum) rest b))
                 ((rev accum () b) (f () accum b))))
          (f (syntax-rules ()
               ((f accum ((define (var . spec) . e) . rest) b)
                (f ((var (lambda  spec . e)) . accum) rest b))
               ((f accum ((define var e) . rest) b)
                (f ((var e) . accum) rest b))
               ((f accum () b) (letrec accum . b)))))
       (rev () defs body)))))


More information about the Gambit-list mailing list