loop: destructuring: allow values shorter than variables

We achieve that by adding &optional to every sublist. Fixes #605.
This commit is contained in:
Daniel Kochmański 2020-08-14 16:30:54 +02:00
parent b2c9ea8c6e
commit 809b9de86f

View file

@ -659,8 +659,12 @@ collected result will be returned as the value of the LOOP."
(cond
((null tree) (car (push (gensym) *ignores*)))
((atom tree) tree)
(t (cons (subst-gensyms-for-nil (car tree))
(subst-gensyms-for-nil (cdr tree))))))
((atom (cdr tree))
(cons (subst-gensyms-for-nil (car tree))
(subst-gensyms-for-nil (cdr tree))))
(t
(list* '&optional
(mapcar #'subst-gensyms-for-nil tree)))))
(defun loop-build-destructuring-bindings (crocks forms)
(if crocks