Package: alexandria
Macro destructuring-ecase
Lambda Listdestructuring-ecase (keyform &body clauses) SyntaxDetails The macro destructuring-ecase is a combination of ecase
and destructuring-bind. keyform must evaluate to a cons. The clause whose case-keys matches car of key, as if by ecase is selected, and forms are then executed with cdr of key is destructured and bound by the destructuring-lambda-list. Examples
(defun decase (x)
(destructuring-case x
((:foo a b)
(format nil "foo: ~S, ~S" a b))
((:bar &key a b)
(format nil "bar, ~S, ~S" a b))
(((:alt1 :alt2) a)
(format nil "alt: ~S" a)))) | See also |