Node: Lambda-list-directed Destructuring by Lambda Lists, Previous: Examples of Data-directed Destructuring by Lambda Lists, Up: Macro Lambda Lists
An extension of data-directed destructuring of trees is lambda-list-directed destructuring. This derives from the analogy between the three-element destructuring pattern
(first second third)
and the three-argument lambda list
(first second third)
Lambda-list-directed destructuring is identical to data-directed destructuring if no lambda list keywords appear in the pattern. Any list in the pattern (whether a sub-list or the whole pattern itself) that contains a lambda list keyword is interpreted specially. Elements of the list to the left of the first lambda list keyword are treated as destructuring patterns, as usual, but the remaining elements of the list are treated like a function's lambda list except that where a variable would normally be required, an arbitrary destructuring pattern is allowed. Note that in case of ambiguity, lambda list syntax is preferred over destructuring syntax. Thus, after &optional a list of elements is a list of a destructuring pattern and a default value form.
The detailed behavior of each lambda list keyword in a lambda-list-directed destructuring pattern is as follows:
The rest of the list being destructured
is taken to be alternating keywords and values and is taken apart appropriately.