Skip to content
Snippets Groups Projects
Commit 612700cd authored by Philipp Marek's avatar Philipp Marek
Browse files

Avoid duplicate logic in WHEN-LET*.

By using an explicit PROGN we can interpolate straight into the LET.
The PROGN shouldn't matter, as the WHEN interferes with DECLAREs anyway.
parent a532b41a
No related branches found
No related tags found
No related merge requests found
......@@ -79,15 +79,13 @@ Execution of WHEN-LET* stops immediately if any INITIAL-FORM evaluates to NIL.
If all INITIAL-FORMs evaluate to true, then BODY is executed as an implicit
PROGN."
(let ((binding-list (if (and (consp bindings) (symbolp (car bindings)))
(list bindings)
bindings)))
(list bindings)
bindings)))
(labels ((bind (bindings body)
(if bindings
`((let (,(car bindings))
(when ,(caar bindings)
,@(bind (cdr bindings) body))))
body)))
`(let (,(car binding-list))
(when ,(caar binding-list)
,@(bind (cdr binding-list) body))))))
`(let (,(car bindings))
(when ,(caar bindings)
(bind (cdr bindings) body)))
`(progn ,@body))))
(bind (cdr binding-list) body))))
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