Skip to content

Instantly share code, notes, and snippets.

@stibear
Created December 15, 2013 13:23
Show Gist options
  • Save stibear/7973046 to your computer and use it in GitHub Desktop.
Save stibear/7973046 to your computer and use it in GitHub Desktop.
(define-syntax swap!
(rsc-macro-transformer
(lambda (form env)
(let ((a (cadr form))
(b (caddr form))
(value (make-syntactic-closure env '() 'value))
(let-r (make-syntactic-closure env '() 'let))
(set!-r (make-syntactic-closure env '() 'set!)))
`(,let-r ((,value ,a))
(,set!-r ,a ,b)
(,set!-r ,b ,value))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment