2
;;;; Author: Paul Dietz
3
;;;; Created: Sun Apr 20 07:22:46 2003
4
;;;; Contains: Tests of MAPCAN
8
(compile-and-load "cons-aux.lsp")
15
(mapcan #'list (copy-list '(a b c d e f)))
19
(let* ((x (list 'a 'b 'c 'd))
20
(xcopy (make-scaffold-copy x))
21
(result (mapcan #'list x)))
23
(= (length x) (length result))
24
(check-scaffold-copy x xcopy)
28
count (or (eqt e1 e2) (not (eql (car e1) (car e2)))))))
33
(copy-list '(1 2 3 4))
34
(copy-list '(a b c d)))
38
(mapcan #'(lambda (x y) (make-list y :initial-element x))
39
(copy-list '(a b c d))
40
(copy-list '(1 2 3 4)))
41
(a b b c c c d d d d))
43
(defvar *mapcan.6-var* nil)
44
(defun mapcan.6-fun (x)
45
(push x *mapcan.6-var*)
46
(copy-list *mapcan.6-var*))
50
(setf *mapcan.6-var* nil)
51
(mapcan 'mapcan.6-fun (copy-list '(a b c d))))
52
(a b a c b a d c b a))
54
(deftest mapcan.order.1
57
(mapcan (progn (setf x (incf i))
59
(progn (setf y (incf i))
61
(progn (setf z (incf i))
68
(mapcan #'(lambda (x y) (make-list y :initial-element x))
69
(copy-list '(a b c d))
70
(copy-list '(1 2 3 4 5 6)))
71
(a b b c c c d d d d))
74
(mapcan #'(lambda (x y) (make-list y :initial-element x))
75
(copy-list '(a b c d e f))
76
(copy-list '(1 2 3 4)))
77
(a b b c c c d d d d))
81
(copy-list '(a b c d))
82
(copy-list '(1 2 3 4))
87
(mapcan (constantly 1) (list 'a))
90
(deftest mapcan.error.1
91
(signals-error (mapcan #'identity 1) type-error)
94
(deftest mapcan.error.2
95
(signals-error (mapcan) program-error)
98
(deftest mapcan.error.3
99
(signals-error (mapcan #'append) program-error)
102
(deftest mapcan.error.4
103
(signals-error (locally (mapcan #'identity 1) t) type-error)
106
(deftest mapcan.error.5
107
(signals-error (mapcan #'car '(a b c)) type-error)
110
(deftest mapcan.error.6
111
(signals-error (mapcan #'cons '(a b c)) program-error)
114
(deftest mapcan.error.7
115
(signals-error (mapcan #'cons '(a b c) '(1 2 3) '(4 5 6))
119
(deftest mapcan.error.8
120
(signals-error (mapcan #'identity (list* (list 1) (list 2) 3))