Created
March 7, 2016 19:36
-
-
Save lispm/8498a9a58c0d511f986d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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