Skip to content
Snippets Groups Projects
Commit 1144015f authored by Raymond Toy's avatar Raymond Toy
Browse files

Fix #91: Handle loop destructuring

The destructuring shortcut in loop doesn't require all the parts be
available.  If they're not, each item is replaced by NIL.

This is fixed by still using `destructuring-bind`, except we mark
everything as optional.
parent fdeafbc6
No related branches found
No related tags found
No related merge requests found
......@@ -995,7 +995,10 @@ collected result will be returned as the value of the LOOP."
(if crocks
(let ((*ignores* ()))
(declare (special *ignores*))
`((destructuring-bind ,(subst-gensyms-for-nil (car crocks))
;; Destructuring in loop doesn't require that the values be
;; available. The missing elements are filled with NIL. So,
;; make everything &optional
`((destructuring-bind (&optional ,@(subst-gensyms-for-nil (car crocks)))
,(cadr crocks)
(declare (ignore ,@*ignores*))
,@(loop-build-destructuring-bindings (cddr crocks) forms))))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment