CARTESIAN-PRODUCT-SWITCH is a macro for choosing the appropriate form to execute according to the combined results of multiple tests. This is a straightforward and efficient alternative to the convoluted ad-hoc conditionals one might otherwise resort to.

Here's an example:

(let ((manner :flip) (direction :backward)) (cartesian-product-switch ((case manner :walk :flip) (case direction :forward :in-place :backward)) "Walking..." (error "Walking in-place is too boring!") "Awkwardly walking backwards..." "Frontflip!" "Jumping in-place." "Backflip!" (t (error "Don't know how to ~A while going ~A." manner direction))))

Currently supported testclause kinds:
(case ccase ecase typecase ctypecase etypecase if cond svref)

cartesian-product-switch is in Quicklisp:

(ql:quickload "cartesian-product-switch")

See the project's home for further information, including how to make your own kinds of testclauses.
This library is in the Public Domain. See the UNLICENSE file for details.

pattern matching convenience library