User Tools


Function TYPE-ERROR-DATUM, TYPE-ERROR-EXPECTED-TYPE

Syntax

  • type-error-datum conditiondatum
  • type-error-expected-type conditionexpected-type

Arguments and Values

Description

type-error-datum returns the offending datum in the situation represented by the condition.

type-error-expected-type returns the expected type of the offending datum in the situation represented by the condition.

Examples

;;; TODO fix this so this doesn't always store 7 but val instead (defun fix-digits (condition) (check-type condition type-error) (let* ((digits '(zero one two three four five six seven eight nine)) (val (position (type-error-datum condition) digits))) (if (and val (subtypep 'fixnum (type-error-expected-type condition))) (store-value 7))))

FIX-DIGITS

(defun foo (x) (handler-bind ((type-error #'fix-digits)) (check-type x number) (+ x 3)))

FOO

(foo 'seven)

10

Side Effects

None.

Affected By

None.

Exceptional Situations

None.

See Also

Notes

None.