RosettaCodeData/Task/Inverted-syntax/Common-Lisp/inverted-syntax-1.lisp

11 lines
345 B
Common Lisp
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
(eval-when (:compile-toplevel :load-toplevel :execute)
(defun unrev-syntax (form)
(cond
((atom form) form)
((null (cddr form)) form)
(t (destructuring-bind (oper &rest args) (reverse form)
`(,oper ,@(mapcar #'unrev-syntax args)))))))
(defmacro rprogn (&body forms)
`(progn ,@(mapcar #'unrev-syntax forms)))