chickadee » srfi-253 » check-case

(check-case expr (predicate? body ...) ... [(else else-body ...)])syntax

Checks whether the expression expr satisfies one of the predicates. If any of the predicates is satisfied, it evaluates the body corresponding to the first one that is satisfied, in left-to-right order. If none of the predicates is satisfied, one of two things may happen:

  1. If an else clause is present, the body of that else clause is evaluated.
  2. If an else clause is not present, an error is instead raised.

While this is similar to something like compiler-typecase, this form specifically guarantees that a missing else block won't result in a syntax-expansion error if run in the interpreter or with -specialization disabled at compile time.