Skip to content

@ichimal /ntuple_builder.lisp
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
builder of "make-N-tuple" function
(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)) ))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.