A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.lispworks.com/documentation/lw60/CLHS/Body/f_tp_err.htm below:

CLHS: Function TYPE-ERROR-DATUM, TYPE-ERROR-EXPECTED-TYPE

CLHS: Function TYPE-ERROR-DATUM, TYPE-ERROR-EXPECTED-TYPE Function TYPE-ERROR-DATUM, TYPE-ERROR-EXPECTED-TYPE

Syntax:

type-error-datum condition => datum

type-error-expected-type condition => expected-type

Arguments and Values:

condition---a condition of type type-error.

datum---an object.

expected-type---a type specifier.

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:

 (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))))
 
 (defun foo (x)
   (handler-bind ((type-error #'fix-digits))
     (check-type x number)
     (+ x 3)))
 
 (foo 'seven)
=>  10

Side Effects: None.

Affected By: None.

Exceptional Situations: None.

See Also:

type-error, Section 9 (Conditions)

Notes: None.


Copyright 1996-2005, LispWorks Ltd. All rights reserved.

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4