[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Destructuring



I have a note talking about reasons for a destructure feature if
anybody wants me to sent it to them. Suffice it to say that destructuring
is used heavily in the evaluator, compiler, and macrology of NIL, and it
has saved a lot of CAR/CDR'ing and control structure. The name I suggest
for the special form is DESTRUCTURE. It isn't very difficult to
implement entirely in lisp, with no restrictions on keyword placement etc.
;; Here is an example call:
(defknown si:examine-byte (form)
  (destructure form
    (p &optional (i 0)) 
    ...)))
;; Which is equivalent to:
(defknown si:examine-byte (form)
  (dspread&apply (lambda (p i) ...) '(p &optional (i 0)) form))
;; Which is a pretty good hint of how it is implemented in NIL.  -GJC