; Scheme 9 from Empty Space, Function Library
; By Nils M Holm, 2010
; See the LICENSE file of the S9fES package for terms of use
;
; (swap! <variable1> <variable2>)  ==>  unspecific
;
; Swap the values bound to <variable1> and and <variable2>.
;
; Example:   (let ((a 0)
;                  (b 1))
;              (swap! a b)
;              (list a b))  ==>  (1 0)

(define-syntax (swap! a b)
  (let ((t (gensym)))
    `(let ((,t ,a))
       (set! ,a ,b)
       (set! ,b ,t))))
