Re:Carp: A statically typed Lisp, without a GC, for real-tim...
by kbp on Friday April 13, 2018 @04:52PM
(#16833806)
And while it didn't make it into the Common Lisp version of LET, there were versions in earlier dialects that supported destructuring. For example, the Maclisp reference manual's description of LET[0] says:
It is permissible to place an s-expression pattern in place of a symbol in the (sym init) form of an element of the bvlspec. The symbols in the pattern will become bound to the matching elements of the initialization (see DESETQ). This kind of pattern-matched assignment is called destructuring.
(let (((a b) '(1 2)))
(cons b a))
=> (2 . 1)
0: http://www.maclisp.info/pitmanual/contro.html#5.6.1
That being said, I tend to use destructuring in common-lisp, and if you are taking an element from a collection by using c*r then you are probably doing it wrong.
Optima has more complete support for destructuring, but this works just fine in CL with out any libraries: