chickadee » moremacros » type-case

(type-case EXPRESSION [(TYPE-CASE BODY ...) ...]))syntax

Expands into a form that selects a TYPE-CASE based on the type of the EXPRESSION.

A TYPE-CASE is:

symbol
the base name of a type predicate
(symbol symbol...)
a list of base names
else
an else clause

The actual name of the predicate is built from the base name and a ? suffix. So a base name number has the predicate number?.

(import moremacros)

(type-case 23
  ((symbol string char) 'symbolic)
  (number               'numeric)
  (else                 'otheric) )
;=> numeric