RosettaCodeData/Task/Generic-swap/Emacs-Lisp/generic-swap-3.l
2015-02-20 00:35:01 -05:00

8 lines
149 B
Common Lisp

(require 'cl)
(defmacro swap (a b)
`(psetf ,a ,b
,b ,a))
(setq lst (list 123 456))
(swap (car lst) (cadr lst))
;; now lst is '(456 123)