chickadee » coerce » coerce-extend!

coerce-extend! TYPE-TAG TYPE-PRED CONVERTORprocedure

Extends the domain of coerce with the type definition (TYPE-TAG TYPE-PRED CONVERTOR).

TYPE-PRED is a procedure, (object -> boolean), testing whether the argument is a type.

CONVERTOR is a procedure, (object symbol on-error -> object), converting from the type to a result type.

The CONVERTOR must invoke (on-error) when conversion not possible. Usually case-coerce would be used to create the CONVERTOR, which automatically handles calling of the on-error argument.