[851cd0]: src / ansi-tests / lists155.lisp Maximize Restore History

Download this file

lists155.lisp    204 lines (177 with data), 3.3 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
;;; based on v1.2 -*- mode: lisp -*-
(in-package :cl-user)
(my-assert
(member 'a
'((a)
(b)
(a)
(c)))
nil)
(my-assert
(member 'a
'((a)
(b)
(a)
(c))
:key 'car)
((a)
(b)
(a)
(c)))
(my-assert
(member-if 'numberp
'((a)
(b)
(3)
(c))
:key 'car)
((3)
(c)))
(my-assert
(member-if-not 'numberp
'((8)
(a)
(b)
(3)
(c))
:key 'car)
((a)
(b)
(3)
(c)))
(my-assert
(tailp '(a b)
'(u a b))
nil)
(my-assert
(tailp (cddr (setq xx
'(u i a b)))
xx)
t)
(my-assert
(tailp (cddr (setq xx
'(u i a b)))
xx)
t)
(my-assert
(adjoin 'a
'(a b c))
(a b c))
(my-assert
(adjoin 'a
'((a)
b c)
:test 'equal)
(a (a)
b c))
(my-assert
(adjoin 'a
'((a)
b c)
:test 'equal)
(a (a)
b c))
(my-assert
(union '(a b c d)
'(a d i v))
#+xcl (v i a b c d)
#+(or clisp akcl ecl) (b c a d i v)
#+(or allegro cmu sbcl) (c b a d i v)
#-(or xcl clisp akcl allegro cmu sbcl ecl) unknown)
(my-assert
(nunion '(a b c d)
'(u i b a))
#+xcl (a b c d u i)
#+(or clisp akcl ecl) (c d u i b a)
#+(or allegro cmu sbcl) (d c u i b a)
#-(or xcl clisp akcl allegro cmu sbcl ecl) unknown)
(my-assert
(nintersection '(a b c d)
'(c d e f g))
#+(or xcl clisp gcl ecl) (c d)
#+(or allegro cmu sbcl) (d c)
#-(or xcl clisp gcl allegro cmu sbcl ecl) unknown)
(my-assert
(nintersection '(a b c d)
'(c d e f g)
:test-not 'eql)
#+(or xcl clisp gcl ecl) (a b c d)
#+(or allegro cmu sbcl) (d c b a)
#-(or xcl clisp gcl allegro cmu sbcl ecl) unknown)
(my-assert
(set-difference '(a b c d e)
'(d b e))
#+(or xcl allegro gcl cmu sbcl ecl) (c a)
#+(or clisp (and akcl (not gcl))) (a c)
#-(or xcl clisp akcl allegro cmu sbcl ecl) unknown)
(my-assert
(set-difference
'(auto anton berta berlin)
'(a)
:test
#'(lambda (x y)
(eql (elt (symbol-name x)
1)
(elt (symbol-name y)
1))))
#+(or xcl allegro)
(berlin berta anton auto)
#-(or xcl allegro)
type-error)
(my-assert
(set-difference '(anton berta auto berlin)
'(amerilla)
:test
#'(lambda (x y)
(eql (elt (symbol-name x)
0)
(elt (symbol-name y)
0))))
#+(or xcl gcl allegro cmu sbcl) (berlin berta)
#+(or clisp (and akcl (not gcl)) ecl) (berta berlin)
#-(or xcl clisp akcl allegro cmu sbcl ecl) unknown)
(my-assert
(nset-difference '(a b c d)
'(i j c))
#+(or xcl clisp gcl ecl) (a b d)
#+(or allegro cmu sbcl) (d b a)
#-(or xcl clisp gcl allegro cmu sbcl ecl) unknown)
(my-assert
(set-exclusive-or '(a b c d)
'(c a i l))
#+(or xcl gcl) (d b l i)
#+(or clisp (and akcl (not gcl)) ecl) (b d i l)
#+(or allegro cmu sbcl) (l i d b)
#-(or xcl clisp akcl allegro cmu sbcl ecl) unknown)
(my-assert
(set-exclusive-or '(anton anna emil)
'(berta auto august)
:test
#'(lambda (x y)
(eql (elt (symbol-name x)
0)
(elt (symbol-name y)
0))))
#+(or xcl clisp gcl ecl) (emil berta)
#+(or allegro cmu sbcl) (berta emil)
#-(or xcl clisp gcl allegro cmu sbcl ecl) unknown)
(my-assert
(nset-exclusive-or '(a b c)
'(i a d c))
(b i d))
(my-assert
(subsetp '(a b)
'(b u i a c d))
t)
(my-assert
(subsetp '(a b)
'(b u i c d))
nil)
(my-assert
(subsetp '(a b)
'(b a u i c d))
t)
(my-assert
(subsetp '(a b)
'(a u i c d))
nil)