chickadee » srfi-99 » variant-case

(variant-case RTD V ((VARIANT FIELD ...) . BODY) [(else . BODY)])syntax

The form first ensures that V is indeed an instance of RTD, raising a type error otherwise.

Each VARIANT designates a variant subtype constructor, each FIELD is an identifier to be bound to the corresponding, identically named field of the variant instance. If any of the variant clauses matches the type of V, the corresponding BODY is evaluated and the result is returned from the variant-case form.

If none of the variant clauses match the type of V, the else clause's BODY is evaluated instead. If no else clause is present either, an error is raised indicating that no matching variant was found.