Skip to content

Instantly share code, notes, and snippets.

@stibear
Last active December 31, 2015 10:29
Show Gist options
  • Save stibear/7973255 to your computer and use it in GitHub Desktop.
Save stibear/7973255 to your computer and use it in GitHub Desktop.
(define-syntax swap!
(er-macro-transformer
(lambda (form rename compare?)
(let ((a (cadr form))
(b (caddr form)))
`(,(rename 'let) ((,(rename 'value) ,a))
(,(rename 'set!) ,a ,b)
(,(rename 'set!) ,b ,(rename 'value)))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment