Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
builder of "make-N-tuple" function
(ql:quickload :cl-case-control)
(defmacro build-make-n-tuple-of (args)
(let ((expanded (eval args)))
,@(loop for elm in `(,@expanded)
collect (list 'build-make-n-tuple elm))
nil )))
(defmacro build-make-n-tuple (n)
(declare (type (integer 0 *) n))
(check-type n (integer 0 *) "integer >=0")
(let ((fsym (intern (casectl:adj-case (format nil "make-~d-tuple" n))))
(args (loop for i from 1 to n collect (gensym))) )
`(defun ,fsym (,@args) (list ,@args)) ))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment