aboutsummaryrefslogtreecommitdiff
path: root/src/algebra/strap/LIST.lsp
blob: 5ab75d1373f04ab2036bcc21e0239bee6759e0bb (plain)
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
(/VERSIONCHECK 2) 

(DECLAIM (FTYPE (FUNCTION (|%Shell|) |%List|) |LIST;nil;$;1|)) 

(PUT '|LIST;nil;$;1| '|SPADreplace| '(XLAM NIL NIL)) 

(DECLAIM (FTYPE (FUNCTION (|%List| |%Shell|) |%Boolean|)
                |LIST;null;$B;2|)) 

(PUT '|LIST;null;$B;2| '|SPADreplace| 'NULL) 

(DECLAIM (FTYPE (FUNCTION (|%Thing| |%List| |%Shell|) |%List|)
                |LIST;cons;S2$;3|)) 

(PUT '|LIST;cons;S2$;3| '|SPADreplace| 'CONS) 

(DECLAIM (FTYPE (FUNCTION (|%List| |%List| |%Shell|) |%List|)
                |LIST;append;3$;4|)) 

(PUT '|LIST;append;3$;4| '|SPADreplace| 'APPEND) 

(DECLAIM (FTYPE (FUNCTION (|%Thing| |%List| |%Shell|) |%Void|)
                |LIST;writeOMList|)) 

(DECLAIM (FTYPE (FUNCTION (|%List| |%Shell|) |%String|)
                |LIST;OMwrite;$S;6|)) 

(DECLAIM (FTYPE (FUNCTION (|%List| |%Boolean| |%Shell|) |%String|)
                |LIST;OMwrite;$BS;7|)) 

(DECLAIM (FTYPE (FUNCTION (|%Thing| |%List| |%Shell|) |%Void|)
                |LIST;OMwrite;Omd$V;8|)) 

(DECLAIM (FTYPE (FUNCTION (|%Thing| |%List| |%Boolean| |%Shell|)
                    |%Void|)
                |LIST;OMwrite;Omd$BV;9|)) 

(DECLAIM (FTYPE (FUNCTION (|%List| |%List| |%Shell|) |%List|)
                |LIST;setUnion;3$;10|)) 

(DECLAIM (FTYPE (FUNCTION (|%List| |%List| |%Shell|) |%List|)
                |LIST;setIntersection;3$;11|)) 

(DECLAIM (FTYPE (FUNCTION (|%List| |%List| |%Shell|) |%List|)
                |LIST;setDifference;3$;12|)) 

(DECLAIM (FTYPE (FUNCTION (|%List| |%Shell|) |%Thing|)
                |LIST;convert;$If;13|)) 

(DEFUN |LIST;nil;$;1| ($) (DECLARE (IGNORE $)) NIL) 

(DEFUN |LIST;null;$B;2| (|l| $) (DECLARE (IGNORE $)) (NULL |l|)) 

(DEFUN |LIST;cons;S2$;3| (|s| |l| $)
  (DECLARE (IGNORE $))
  (CONS |s| |l|)) 

(DEFUN |LIST;append;3$;4| (|l| |t| $)
  (DECLARE (IGNORE $))
  (APPEND |l| |t|)) 

(DEFUN |LIST;writeOMList| (|dev| |x| $)
  (SEQ (SPADCALL |dev| (|getShellEntry| $ 16))
       (SPADCALL |dev| "list1" "list" (|getShellEntry| $ 18))
       (LOOP
         (COND
           ((NOT (NOT (NULL |x|))) (RETURN NIL))
           (T (SEQ (SPADCALL |dev|
                       (SPADCALL |x| (|getShellEntry| $ 20)) NIL
                       (|getShellEntry| $ 22))
                   (EXIT (SETQ |x|
                               (SPADCALL |x| (|getShellEntry| $ 23))))))))
       (EXIT (SPADCALL |dev| (|getShellEntry| $ 24))))) 

(DEFUN |LIST;OMwrite;$S;6| (|x| $)
  (LET* ((|s| "") (|sp| (OM-STRINGTOSTRINGPTR |s|))
         (|dev| (SPADCALL |sp| (SPADCALL (|getShellEntry| $ 26))
                    (|getShellEntry| $ 27))))
    (SEQ (SPADCALL |dev| (|getShellEntry| $ 28))
         (|LIST;writeOMList| |dev| |x| $)
         (SPADCALL |dev| (|getShellEntry| $ 29))
         (SPADCALL |dev| (|getShellEntry| $ 30))
         (SETQ |s| (OM-STRINGPTRTOSTRING |sp|)) (EXIT |s|)))) 

(DEFUN |LIST;OMwrite;$BS;7| (|x| |wholeObj| $)
  (LET* ((|s| "") (|sp| (OM-STRINGTOSTRINGPTR |s|))
         (|dev| (SPADCALL |sp| (SPADCALL (|getShellEntry| $ 26))
                    (|getShellEntry| $ 27))))
    (SEQ (COND (|wholeObj| (SPADCALL |dev| (|getShellEntry| $ 28))))
         (|LIST;writeOMList| |dev| |x| $)
         (COND (|wholeObj| (SPADCALL |dev| (|getShellEntry| $ 29))))
         (SPADCALL |dev| (|getShellEntry| $ 30))
         (SETQ |s| (OM-STRINGPTRTOSTRING |sp|)) (EXIT |s|)))) 

(DEFUN |LIST;OMwrite;Omd$V;8| (|dev| |x| $)
  (SEQ (SPADCALL |dev| (|getShellEntry| $ 28))
       (|LIST;writeOMList| |dev| |x| $)
       (EXIT (SPADCALL |dev| (|getShellEntry| $ 29))))) 

(DEFUN |LIST;OMwrite;Omd$BV;9| (|dev| |x| |wholeObj| $)
  (SEQ (COND (|wholeObj| (SPADCALL |dev| (|getShellEntry| $ 28))))
       (|LIST;writeOMList| |dev| |x| $)
       (EXIT (COND
               (|wholeObj| (SPADCALL |dev| (|getShellEntry| $ 29))))))) 

(DEFUN |LIST;setUnion;3$;10| (|l1| |l2| $)
  (SPADCALL (SPADCALL |l1| |l2| (|getShellEntry| $ 35))
            (|getShellEntry| $ 36))) 

(DEFUN |LIST;setIntersection;3$;11| (|l1| |l2| $)
  (LET ((|u| (SPADCALL (|getShellEntry| $ 38))))
    (SEQ (SETQ |l1| (SPADCALL |l1| (|getShellEntry| $ 36)))
         (LOOP
           (COND
             ((NOT (NOT (SPADCALL |l1| (|getShellEntry| $ 39))))
              (RETURN NIL))
             (T (SEQ (COND
                       ((SPADCALL
                            (SPADCALL |l1| (|getShellEntry| $ 20)) |l2|
                            (|getShellEntry| $ 40))
                        (SETQ |u|
                              (CONS (SPADCALL |l1|
                                     (|getShellEntry| $ 20))
                                    |u|))))
                     (EXIT (SETQ |l1|
                                 (SPADCALL |l1| (|getShellEntry| $ 23))))))))
         (EXIT |u|)))) 

(DEFUN |LIST;setDifference;3$;12| (|l1| |l2| $)
  (PROG (|lu| |l11|)
    (RETURN
      (SEQ (SETQ |l1| (SPADCALL |l1| (|getShellEntry| $ 36)))
           (LETT |lu| (SPADCALL (|getShellEntry| $ 38))
                 |LIST;setDifference;3$;12|)
           (LOOP
             (COND
               ((NOT (NOT (SPADCALL |l1| (|getShellEntry| $ 39))))
                (RETURN NIL))
               (T (SEQ (LETT |l11|
                             (SPADCALL |l1| 1 (|getShellEntry| $ 42))
                             |LIST;setDifference;3$;12|)
                       (COND
                         ((NOT (SPADCALL |l11| |l2|
                                   (|getShellEntry| $ 40)))
                          (SETQ |lu|
                                (SPADCALL |l11| |lu|
                                    (|getShellEntry| $ 43)))))
                       (EXIT (SETQ |l1|
                                   (SPADCALL |l1|
                                    (|getShellEntry| $ 23))))))))
           (EXIT |lu|))))) 

(DEFUN |LIST;convert;$If;13| (|x| $)
  (SPADCALL
      (CONS (SPADCALL '|construct| (|getShellEntry| $ 47))
            (LET ((#0=#:G1444 |x|) (#1=#:G1443 NIL))
              (LOOP
                (COND
                  ((ATOM #0#) (RETURN (NREVERSE #1#)))
                  (T (LET ((|a| (CAR #0#)))
                       (SETQ #1#
                             (CONS (SPADCALL |a|
                                    (|getShellEntry| $ 48))
                                   #1#)))))
                (SETQ #0# (CDR #0#)))))
      (|getShellEntry| $ 52))) 

(DEFUN |List| (#0=#:G1445)
  (DECLARE (SPECIAL |$ConstructorCache|))
  (PROG (#1=#:G1446)
    (RETURN
      (COND
        ((SETQ #1#
               (|lassocShiftWithFunction| (LIST (|devaluate| #0#))
                   (HGET |$ConstructorCache| '|List|)
                   '|domainEqualList|))
         (|CDRwithIncrement| #1#))
        (T (UNWIND-PROTECT
             (PROG1 (|List;| #0#) (SETQ #1# T))
             (COND ((NOT #1#) (HREM |$ConstructorCache| '|List|))))))))) 

(DEFUN |List;| (|#1|)
  (LET* ((|dv$1| (|devaluate| |#1|)) (|dv$| (LIST '|List| |dv$1|))
         ($ (|newShell| 70))
         (|pv$| (|buildPredVector| 0 0
                    (LIST (OR (AND (|HasCategory| |#1| '(|OrderedSet|))
                                   (|HasCategory| |#1|
                                    (LIST '|Evalable|
                                     (|devaluate| |#1|))))
                              (AND (|HasCategory| |#1|
                                    '(|SetCategory|))
                                   (|HasCategory| |#1|
                                    (LIST '|Evalable|
                                     (|devaluate| |#1|)))))
                          (OR (AND (|HasCategory| |#1|
                                    '(|SetCategory|))
                                   (|HasCategory| |#1|
                                    (LIST '|Evalable|
                                     (|devaluate| |#1|))))
                              (|HasCategory| |#1|
                                  (LIST '|CoercibleTo| '(|OutputForm|))))
                          (|HasCategory| |#1|
                              (LIST '|ConvertibleTo| '(|InputForm|)))
                          (OR (|HasCategory| |#1| '(|OrderedSet|))
                              (|HasCategory| |#1| '(|SetCategory|)))
                          (|HasCategory| |#1| '(|OrderedSet|))
                          (OR (|HasCategory| |#1| '(|BasicType|))
                              (|HasCategory| |#1| '(|OrderedSet|))
                              (|HasCategory| |#1| '(|SetCategory|)))
                          (|HasCategory| |#1| '(|OpenMath|))
                          (|HasCategory| (|Integer|) '(|OrderedSet|))
                          (|HasCategory| |#1| '(|SetCategory|))
                          (|HasCategory| |#1|
                              (LIST '|CoercibleTo| '(|OutputForm|)))
                          (|HasCategory| |#1| '(|BasicType|))
                          (AND (|HasCategory| |#1| '(|SetCategory|))
                               (|HasCategory| |#1|
                                   (LIST '|Evalable|
                                    (|devaluate| |#1|))))))))
    (DECLARE (SPECIAL |$ConstructorCache|))
    (|setShellEntry| $ 0 |dv$|)
    (|setShellEntry| $ 3 |pv$|)
    (|haddProp| |$ConstructorCache| '|List| (LIST |dv$1|) (CONS 1 $))
    (|stuffDomainSlots| $)
    (|setShellEntry| $ 6 |#1|)
    (COND
      ((|testBitVector| |pv$| 7)
       (PROGN
         (|setShellEntry| $ 31
             (CONS (|dispatchFunction| |LIST;OMwrite;$S;6|) $))
         (|setShellEntry| $ 32
             (CONS (|dispatchFunction| |LIST;OMwrite;$BS;7|) $))
         (|setShellEntry| $ 33
             (CONS (|dispatchFunction| |LIST;OMwrite;Omd$V;8|) $))
         (|setShellEntry| $ 34
             (CONS (|dispatchFunction| |LIST;OMwrite;Omd$BV;9|) $)))))
    (COND
      ((|testBitVector| |pv$| 9)
       (PROGN
         (|setShellEntry| $ 37
             (CONS (|dispatchFunction| |LIST;setUnion;3$;10|) $))
         (|setShellEntry| $ 41
             (CONS (|dispatchFunction| |LIST;setIntersection;3$;11|) $))
         (|setShellEntry| $ 44
             (CONS (|dispatchFunction| |LIST;setDifference;3$;12|) $)))))
    (COND
      ((|testBitVector| |pv$| 3)
       (|setShellEntry| $ 53
           (CONS (|dispatchFunction| |LIST;convert;$If;13|) $))))
    $)) 

(MAKEPROP '|List| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL (|IndexedList| 6 (NRTEVAL 1))
             (|local| |#1|) (|Integer|) (0 . |One|)
             (CONS IDENTITY
                   (FUNCALL (|dispatchFunction| |LIST;nil;$;1|) $))
             (|Boolean|) |LIST;null;$B;2| |LIST;cons;S2$;3|
             |LIST;append;3$;4| (|Void|) (|OpenMathDevice|)
             (4 . |OMputApp|) (|String|) (9 . |OMputSymbol|)
             (16 . |not|) (21 . |first|) (26 . |false|)
             (30 . |OMwrite|) (37 . |rest|) (42 . |OMputEndApp|)
             (|OpenMathEncoding|) (47 . |OMencodingXML|)
             (51 . |OMopenString|) (57 . |OMputObject|)
             (62 . |OMputEndObject|) (67 . |OMclose|) (72 . |OMwrite|)
             (77 . |OMwrite|) (83 . |OMwrite|) (89 . |OMwrite|)
             (96 . |concat|) (102 . |removeDuplicates|)
             (107 . |setUnion|) (113 . |empty|) (117 . |empty?|)
             (122 . |member?|) (128 . |setIntersection|) (134 . |elt|)
             (140 . |concat|) (146 . |setDifference|) (|OutputForm|)
             (|InputForm|) (152 . |convert|) (157 . |convert|)
             (|List| 46) (162 . |concat|) (|List| $) (168 . |convert|)
             (173 . |convert|) (|Mapping| 6 6 6) (|NonNegativeInteger|)
             (|List| 6) (|Equation| 6) (|List| 57) (|Mapping| 10 6)
             (|Mapping| 10 6 6) (|UniversalSegment| 7) '"last" '"rest"
             '"first" '"value" (|Mapping| 6 6) (|SingleInteger|)
             (|List| 7) (|Union| 6 '"failed"))
          '#(|setUnion| 178 |setIntersection| 184 |setDifference| 190
             |rest| 196 |removeDuplicates| 201 |null| 206 |nil| 211
             |member?| 215 |first| 221 |empty?| 226 |empty| 231 |elt|
             235 |convert| 241 |cons| 246 |concat| 252 |append| 264
             |OMwrite| 270)
          '((|shallowlyMutable| . 0) (|finiteAggregate| . 0))
          (CONS (|makeByteWordVec2| 7
                    '(0 0 0 0 0 0 0 0 0 0 5 0 4 5 0 0 0 1 6 0 1 2 3 7))
                (CONS '#(|ListAggregate&| |StreamAggregate&|
                         |ExtensibleLinearAggregate&|
                         |FiniteLinearAggregate&|
                         |UnaryRecursiveAggregate&| |LinearAggregate&|
                         |RecursiveAggregate&| |IndexedAggregate&|
                         |Collection&| |HomogeneousAggregate&| NIL
                         |EltableAggregate&| |SetCategory&|
                         |OrderedType&| NIL |Aggregate&| NIL
                         |Evalable&| |BasicType&| NIL |InnerEvalable&|
                         NIL NIL NIL)
                      (CONS '#((|ListAggregate| 6)
                               (|StreamAggregate| 6)
                               (|ExtensibleLinearAggregate| 6)
                               (|FiniteLinearAggregate| 6)
                               (|UnaryRecursiveAggregate| 6)
                               (|LinearAggregate| 6)
                               (|RecursiveAggregate| 6)
                               (|IndexedAggregate| 7 6)
                               (|Collection| 6)
                               (|HomogeneousAggregate| 6)
                               (|OrderedSet|) (|EltableAggregate| 7 6)
                               (|SetCategory|) (|OrderedType|)
                               (|Eltable| 61 $$) (|Aggregate|)
                               (|Eltable| 7 6) (|Evalable| 6)
                               (|BasicType|) (|Type|)
                               (|InnerEvalable| 6 6) (|CoercibleTo| 45)
                               (|ConvertibleTo| 46) (|OpenMath|))
                            (|makeByteWordVec2| 53
                                '(0 7 0 8 1 15 14 0 16 3 15 14 0 17 17
                                  18 1 10 0 0 19 1 0 6 0 20 0 10 0 21 3
                                  6 14 15 0 10 22 1 0 0 0 23 1 15 14 0
                                  24 0 25 0 26 2 15 0 17 25 27 1 15 14
                                  0 28 1 15 14 0 29 1 15 14 0 30 1 0 17
                                  0 31 2 0 17 0 10 32 2 0 14 15 0 33 3
                                  0 14 15 0 10 34 2 0 0 0 0 35 1 0 0 0
                                  36 2 0 0 0 0 37 0 0 0 38 1 0 10 0 39
                                  2 0 10 6 0 40 2 0 0 0 0 41 2 0 6 0 7
                                  42 2 0 0 6 0 43 2 0 0 0 0 44 1 46 0
                                  45 47 1 6 46 0 48 2 49 0 46 0 50 1 46
                                  0 51 52 1 0 46 0 53 2 9 0 0 0 37 2 9
                                  0 0 0 41 2 9 0 0 0 44 1 0 0 0 23 1 9
                                  0 0 36 1 0 10 0 11 0 0 0 9 2 9 10 6 0
                                  40 1 0 6 0 20 1 0 10 0 39 0 0 0 38 2
                                  0 6 0 7 42 1 3 46 0 53 2 0 0 6 0 12 2
                                  0 0 0 0 35 2 0 0 6 0 43 2 0 0 0 0 13
                                  3 7 14 15 0 10 34 2 7 17 0 10 32 2 7
                                  14 15 0 33 1 7 17 0 31)))))
          '|lookupIncomplete|))