RosettaCodeData/Task/Function-composition/Common-Lisp/function-composition-4.lisp

7 lines
227 B
Common Lisp

CL-USER> (defmacro compose (fn-name &rest args)
(labels ((rec1 (args)
(if (= (length args) 1)
`(funcall ,@args x)
`(funcall ,(first args) ,(rec1 (rest args))))))
`(defun ,fn-name (x) ,(rec1 args))))