Skip to content
This repository has been archived by the owner on Mar 7, 2018. It is now read-only.

Commit

Permalink
Fixed handling of ignored values (via NILs in expression) in &values
Browse files Browse the repository at this point in the history
  • Loading branch information
scymtym committed Mar 30, 2012
1 parent 8ed6dbc commit 77332c8
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions let-plus.lisp
Expand Up @@ -225,11 +225,23 @@ CONC-NAME. Read-only version."

(define-let+-expansion (&values values :once-only? nil)
"LET+ form for multiple values."
(multiple-value-bind (values ignored) (replace-ignored values)
(let ((temps (map-into (make-list (length values)) #'gensym)))
`(multiple-value-bind ,temps ,value
(declare (ignore ,@ignored))
(let+ (,@(mapcar #'list values temps))
(multiple-value-bind (values ignored-values) (replace-ignored values)
(let (live-values
temps
live-temps
ignored-temps)
(mapc #'(lambda (value)
(let ((temp (gensym)))
(push temp temps)
(if (member value ignored-values)
(push temp ignored-temps)
(progn
(push value live-values)
(push temp live-temps)))))
values)
`(multiple-value-bind ,(nreverse temps) ,value
(declare (ignore ,@(nreverse ignored-temps)))
(let+ (,@(nreverse (mapcar #'list live-values live-temps)))
,@body)))))

(defmethod let+-expansion ((array array) value body)
Expand Down

0 comments on commit 77332c8

Please sign in to comment.