Subject: Re: passing formal arguments to scheme lambda functions?
From: (Rob Warnock)
Date: 2000/05/08
Newsgroups: comp.lang.scheme
Message-ID: <8f5u38$8hm8r$>
Daniel Burrows  <> wrote:
|   If it is [really what he needs to do], though, a macro like
| (define-macro swap!
|   (lambda (a b) `(let ((tmp ,a)) (set! ,a ,b) (set! ,b tmp))))

But don't forget unwanted variable capture. This would be safer, I think:

  (define-macro swap!
    (lambda (a b)
      (let ((tmpname (gensym)))
        `(let ((,tmpname ,a)) (set! ,a ,b) (set! ,b ,tmpname)))))


Rob Warnock, 41L-955
Applied Networking
Silicon Graphics, Inc.		Phone: 650-933-1673
1600 Amphitheatre Pkwy.		PP-ASEL-IA
Mountain View, CA  94043