2
;;;; Author: Paul Dietz
3
;;;; Created: Mon Oct 7 07:34:29 2002
4
;;;; Contains: Tests for type FUNCTION and the special form FUNCTION
9
;;; Note! There are significant incompatibilities between CLTL1 and ANSI CL
10
;;; in the meaning of FUNCTION and FUNCTIONP.
17
;;; The next test demonstrates an incompatibility between CLtL1 and ANSI CL.
18
;;; In ANSI CL, symbols are no longer of type FUNCTION.
20
(typep 'identity 'function)
24
(not-mv (typep #'identity 'function))
28
(loop for x in *cl-symbol-names*
29
for s = (find-symbol x "CL")
30
for f = (and (fboundp s)
32
(not (special-operator-p s))
33
(not (macro-function s))
41
(typep '(setf car) 'function)
44
;;; The next test demonstrates an incompatibility between CLtL1 and ANSI CL.
45
;;; In ANSI CL, lambda forms are no longer of type FUNCTION.
47
(typep '(lambda (x) x) 'function)
50
(report-and-ignore-errors
51
(defun (setf function-7-accessor) (y x) (setf (car x) y) y))
54
(not-mv (typep #'(setf function-7-accessor) 'function))
58
(not-mv (typep #'(lambda (x) x) 'function))
62
(not-mv (typep (compile nil '(lambda (x) x)) 'function))
65
;;; The next test demonstrates an incompatibility between CLtL1 and ANSI CL.
66
;;; In ANSI CL, symbols and cons can no longer also be of type FUNCTION.
68
(loop for x in *universe*
69
when (and (or (numberp x) (characterp x)
77
(flet ((%f () nil)) (typep '%f 'function))
81
(flet ((%f () nil)) (not-mv (typep #'%f 'function)))
85
(labels ((%f () nil)) (not-mv (typep #'%f 'function)))
88
;;; "If name is a function name, the functional definition of that
89
;;; name is that established by the innermost lexically enclosing flet,
90
;;; labels, or macrolet form, if there is one." (page for FUNCTION, sec. 5.3)
92
;;;(deftest function.14
93
;;; (macrolet ((%f () nil)) (not-mv (typep #'%f 'function)))
96
;;; Tests of FUNCTION type specifiers
100
(declare (optimize safety debug))
102
(declare (type (function () null) f))