RosettaCodeData/Task/Generic-swap/Emacs-Lisp/generic-swap-3.l
2023-07-01 13:44:08 -04:00

8 lines
159 B
Common Lisp

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