public
Created

builder of "make-N-tuple" function

  • Download Gist
ntuple_builder.lisp
Common Lisp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
(ql:quickload :cl-case-control)
 
(defmacro build-make-n-tuple-of (args)
(let ((expanded (eval args)))
`(progn
,@(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)) ))

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.