I extended DESTRUCTURING-BIND to allow NIL bindings to indicate a place should be ignored, the way that CL LOOP does. The fact that CL's DESTRUCTURING-BIND doesn't do that, but instead forces the user to make up a name and declare it ignored, is a perennial annoyance. Patch is below.<br>
<br>Daniel<br><br><br>From 5d8b60256a70788c0930724e9d3501551a5e1559 Mon Sep 17 00:00:00 2001<br>From: Daniel Gackle <<a href="mailto:danielgackle@gmail.com">danielgackle@gmail.com</a>><br>Date: Fri, 8 May 2009 14:59:05 -0600<br>
Subject: [PATCH 1/2] Extended DESTRUCTURING-BIND to allow NIL bindings to indicate a place should be ignored, the way that CL LOOP does.<br><br>---<br> src/lib/ps-macro-lib.lisp | 7 +++++--<br> 1 files changed, 5 insertions(+), 2 deletions(-)<br>
<br>diff --git a/src/lib/ps-macro-lib.lisp b/src/lib/ps-macro-lib.lisp<br>index e6c32be..85a55ea 100644<br>--- a/src/lib/ps-macro-lib.lisp<br>+++ b/src/lib/ps-macro-lib.lisp<br>@@ -137,10 +137,13 @@<br> `((@ ,fn :apply) this ,arglist)))<br>
<br> (defpsmacro destructuring-bind (vars expr &body body)<br>- ;; a simple implementation that for now only supports flat lists<br>+ ;; a simple implementation that for now only supports flat lists,<br>+ ;; but does allow NIL bindings to indicate ignore (a la LOOP)<br>
(let* ((arr (if (complex-js-expr? expr) (ps-gensym) expr))<br> (n -1)<br> (bindings<br> (append (unless (equal arr expr) `((,arr ,expr)))<br>- (mapcar (lambda (var) `(,var (aref ,arr ,(incf n)))) vars))))<br>
+ (mapcan (lambda (var)<br>+ (incf n)<br>+ (when var `((,var (aref ,arr ,n))))) vars))))<br> `(let ,bindings ,@body)))<br>-- <br>1.6.1<br><br><br>