Skip to content

Instantly share code, notes, and snippets.

@lispm
Created March 7, 2016 19:36
Show Gist options
  • Save lispm/8498a9a58c0d511f986d to your computer and use it in GitHub Desktop.
Save lispm/8498a9a58c0d511f986d to your computer and use it in GitHub Desktop.
(defun make-vars (vars &aux syms)
(values (loop for var in vars
if (eq var NIL)
collect (let ((sym (gensym "ignore"))) (push sym syms) sym)
else collect var)
syms))
(defmacro multiple-value-bind-some (vars form &body body)
(multiple-value-bind (vars syms) (make-vars vars)
`(multiple-value-bind ,vars ,form
(declare (ignore ,@syms))
,@body)))
(defun foo (x)
(values x (* x 2) (* x 3) (* x 4) (* x 5)))
(defun test ()
(multiple-value-bind-some (a nil nil nil b)
(foo 10)
(list a b)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment