diff options
author | dos-reis <gdr@axiomatics.org> | 2008-08-16 06:00:35 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2008-08-16 06:00:35 +0000 |
commit | 84db9d8c5349cb8b3e7e2d102867e53e610d7ef2 (patch) | |
tree | 0a2689194fd9e75ce8925550a4e177f3e5520684 /src/algebra/list.spad.pamphlet | |
parent | 3372c377eded97a0094f63cddd2e039af7066431 (diff) | |
download | open-axiom-84db9d8c5349cb8b3e7e2d102867e53e610d7ef2.tar.gz |
* algebra/strap: New. Sequester cached Lisp translation of
algebra bootstrap domains here.
Diffstat (limited to 'src/algebra/list.spad.pamphlet')
-rw-r--r-- | src/algebra/list.spad.pamphlet | 945 |
1 files changed, 0 insertions, 945 deletions
diff --git a/src/algebra/list.spad.pamphlet b/src/algebra/list.spad.pamphlet index e702f8f1..3db78db6 100644 --- a/src/algebra/list.spad.pamphlet +++ b/src/algebra/list.spad.pamphlet @@ -201,639 +201,7 @@ IndexedList(S:Type, mn:Integer): Exports == Implementation where merge_!(f, p, q) @ -\section{ILIST.lsp BOOTSTRAP} -{\bf ILIST} depends on a chain of -files. We need to break this cycle to build the algebra. So we keep a -cached copy of the translated {\bf ILIST} category which we can write -into the {\bf MID} directory. We compile the lisp code and copy the -{\bf ILIST.o} file to the {\bf OUT} directory. This is eventually -forcibly replaced by a recompiled version. -Note that this code is not included in the generated catdef.spad file. - -<<ILIST.lsp BOOTSTRAP>>= - -(/VERSIONCHECK 2) - -(PUT '|ILIST;#;$Nni;1| '|SPADreplace| 'LENGTH) - -(DEFUN |ILIST;#;$Nni;1| (|x| $) (LENGTH |x|)) - -(PUT '|ILIST;concat;S2$;2| '|SPADreplace| 'CONS) - -(DEFUN |ILIST;concat;S2$;2| (|s| |x| $) (CONS |s| |x|)) - -(PUT '|ILIST;eq?;2$B;3| '|SPADreplace| 'EQ) - -(DEFUN |ILIST;eq?;2$B;3| (|x| |y| $) (EQ |x| |y|)) - -(PUT '|ILIST;first;$S;4| '|SPADreplace| '|SPADfirst|) - -(DEFUN |ILIST;first;$S;4| (|x| $) (|SPADfirst| |x|)) - -(PUT '|ILIST;elt;$firstS;5| '|SPADreplace| - '(XLAM (|x| "first") (|SPADfirst| |x|))) - -(DEFUN |ILIST;elt;$firstS;5| (|x| T0 $) (|SPADfirst| |x|)) - -(PUT '|ILIST;empty;$;6| '|SPADreplace| '(XLAM NIL NIL)) - -(DEFUN |ILIST;empty;$;6| ($) NIL) - -(PUT '|ILIST;empty?;$B;7| '|SPADreplace| 'NULL) - -(DEFUN |ILIST;empty?;$B;7| (|x| $) (NULL |x|)) - -(PUT '|ILIST;rest;2$;8| '|SPADreplace| 'CDR) - -(DEFUN |ILIST;rest;2$;8| (|x| $) (CDR |x|)) - -(PUT '|ILIST;elt;$rest$;9| '|SPADreplace| - '(XLAM (|x| "rest") (CDR |x|))) - -(DEFUN |ILIST;elt;$rest$;9| (|x| T1 $) (CDR |x|)) - -(DEFUN |ILIST;setfirst!;$2S;10| (|x| |s| $) - (COND - ((SPADCALL |x| (QREFELT $ 17)) - (|error| "Cannot update an empty list")) - ('T (QCAR (RPLACA |x| |s|))))) - -(DEFUN |ILIST;setelt;$first2S;11| (|x| T2 |s| $) - (COND - ((SPADCALL |x| (QREFELT $ 17)) - (|error| "Cannot update an empty list")) - ('T (QCAR (RPLACA |x| |s|))))) - -(DEFUN |ILIST;setrest!;3$;12| (|x| |y| $) - (COND - ((SPADCALL |x| (QREFELT $ 17)) - (|error| "Cannot update an empty list")) - ('T (QCDR (RPLACD |x| |y|))))) - -(DEFUN |ILIST;setelt;$rest2$;13| (|x| T3 |y| $) - (COND - ((SPADCALL |x| (QREFELT $ 17)) - (|error| "Cannot update an empty list")) - ('T (QCDR (RPLACD |x| |y|))))) - -(PUT '|ILIST;construct;L$;14| '|SPADreplace| '(XLAM (|l|) |l|)) - -(DEFUN |ILIST;construct;L$;14| (|l| $) |l|) - -(PUT '|ILIST;parts;$L;15| '|SPADreplace| '(XLAM (|s|) |s|)) - -(DEFUN |ILIST;parts;$L;15| (|s| $) |s|) - -(PUT '|ILIST;reverse!;2$;16| '|SPADreplace| 'NREVERSE) - -(DEFUN |ILIST;reverse!;2$;16| (|x| $) (NREVERSE |x|)) - -(PUT '|ILIST;reverse;2$;17| '|SPADreplace| 'REVERSE) - -(DEFUN |ILIST;reverse;2$;17| (|x| $) (REVERSE |x|)) - -(DEFUN |ILIST;minIndex;$I;18| (|x| $) (QREFELT $ 7)) - -(DEFUN |ILIST;rest;$Nni$;19| (|x| |n| $) - (PROG (|i|) - (RETURN - (SEQ (SEQ (LETT |i| 1 |ILIST;rest;$Nni$;19|) G190 - (COND ((QSGREATERP |i| |n|) (GO G191))) - (SEQ (COND - ((NULL |x|) (|error| "index out of range"))) - (EXIT (LETT |x| (QCDR |x|) |ILIST;rest;$Nni$;19|))) - (LETT |i| (QSADD1 |i|) |ILIST;rest;$Nni$;19|) (GO G190) - G191 (EXIT NIL)) - (EXIT |x|))))) - -(DEFUN |ILIST;copy;2$;20| (|x| $) - (PROG (|i| |y|) - (RETURN - (SEQ (LETT |y| (SPADCALL (QREFELT $ 16)) |ILIST;copy;2$;20|) - (SEQ (LETT |i| 0 |ILIST;copy;2$;20|) G190 - (COND - ((NULL (SPADCALL (NULL |x|) (QREFELT $ 33))) - (GO G191))) - (SEQ (COND - ((EQ |i| 1000) - (COND - ((SPADCALL |x| (QREFELT $ 34)) - (|error| "cyclic list"))))) - (LETT |y| (CONS (QCAR |x|) |y|) - |ILIST;copy;2$;20|) - (EXIT (LETT |x| (QCDR |x|) |ILIST;copy;2$;20|))) - (LETT |i| (QSADD1 |i|) |ILIST;copy;2$;20|) (GO G190) - G191 (EXIT NIL)) - (EXIT (NREVERSE |y|)))))) - -(DEFUN |ILIST;coerce;$Of;21| (|x| $) - (PROG (|s| |y| |z|) - (RETURN - (SEQ (LETT |y| NIL |ILIST;coerce;$Of;21|) - (LETT |s| (SPADCALL |x| (QREFELT $ 36)) - |ILIST;coerce;$Of;21|) - (SEQ G190 (COND ((NULL (NEQ |x| |s|)) (GO G191))) - (SEQ (LETT |y| - (CONS (SPADCALL - (SPADCALL |x| (QREFELT $ 13)) - (QREFELT $ 38)) - |y|) - |ILIST;coerce;$Of;21|) - (EXIT (LETT |x| (SPADCALL |x| (QREFELT $ 18)) - |ILIST;coerce;$Of;21|))) - NIL (GO G190) G191 (EXIT NIL)) - (LETT |y| (NREVERSE |y|) |ILIST;coerce;$Of;21|) - (EXIT (COND - ((SPADCALL |s| (QREFELT $ 17)) - (SPADCALL |y| (QREFELT $ 40))) - ('T - (SEQ (LETT |z| - (SPADCALL - (SPADCALL - (SPADCALL |x| (QREFELT $ 13)) - (QREFELT $ 38)) - (QREFELT $ 42)) - |ILIST;coerce;$Of;21|) - (SEQ G190 - (COND - ((NULL (NEQ |s| - (SPADCALL |x| (QREFELT $ 18)))) - (GO G191))) - (SEQ (LETT |x| - (SPADCALL |x| (QREFELT $ 18)) - |ILIST;coerce;$Of;21|) - (EXIT - (LETT |z| - (CONS - (SPADCALL - (SPADCALL |x| (QREFELT $ 13)) - (QREFELT $ 38)) - |z|) - |ILIST;coerce;$Of;21|))) - NIL (GO G190) G191 (EXIT NIL)) - (EXIT (SPADCALL - (SPADCALL |y| - (SPADCALL - (SPADCALL (NREVERSE |z|) - (QREFELT $ 43)) - (QREFELT $ 44)) - (QREFELT $ 45)) - (QREFELT $ 40))))))))))) - -(DEFUN |ILIST;=;2$B;22| (|x| |y| $) - (PROG (#0=#:G1469) - (RETURN - (SEQ (EXIT (COND - ((EQ |x| |y|) 'T) - ('T - (SEQ (SEQ G190 - (COND - ((NULL (COND - ((NULL |x|) 'NIL) - ('T - (SPADCALL (NULL |y|) - (QREFELT $ 33))))) - (GO G191))) - (SEQ (EXIT - (COND - ((NULL - (SPADCALL (QCAR |x|) (QCAR |y|) - (QREFELT $ 47))) - (PROGN - (LETT #0# 'NIL - |ILIST;=;2$B;22|) - (GO #0#))) - ('T - (SEQ - (LETT |x| (QCDR |x|) - |ILIST;=;2$B;22|) - (EXIT - (LETT |y| (QCDR |y|) - |ILIST;=;2$B;22|))))))) - NIL (GO G190) G191 (EXIT NIL)) - (EXIT (COND - ((NULL |x|) (NULL |y|)) - ('T 'NIL))))))) - #0# (EXIT #0#))))) - -(DEFUN |ILIST;latex;$S;23| (|x| $) - (PROG (|s|) - (RETURN - (SEQ (LETT |s| "\\left[" |ILIST;latex;$S;23|) - (SEQ G190 - (COND - ((NULL (SPADCALL (NULL |x|) (QREFELT $ 33))) - (GO G191))) - (SEQ (LETT |s| - (STRCONC |s| - (SPADCALL (QCAR |x|) - (QREFELT $ 50))) - |ILIST;latex;$S;23|) - (LETT |x| (QCDR |x|) |ILIST;latex;$S;23|) - (EXIT (COND - ((NULL (NULL |x|)) - (LETT |s| (STRCONC |s| ", ") - |ILIST;latex;$S;23|))))) - NIL (GO G190) G191 (EXIT NIL)) - (EXIT (STRCONC |s| " \\right]")))))) - -(DEFUN |ILIST;member?;S$B;24| (|s| |x| $) - (PROG (#0=#:G1477) - (RETURN - (SEQ (EXIT (SEQ (SEQ G190 - (COND - ((NULL (SPADCALL (NULL |x|) - (QREFELT $ 33))) - (GO G191))) - (SEQ (EXIT (COND - ((SPADCALL |s| (QCAR |x|) - (QREFELT $ 47)) - (PROGN - (LETT #0# 'T - |ILIST;member?;S$B;24|) - (GO #0#))) - ('T - (LETT |x| (QCDR |x|) - |ILIST;member?;S$B;24|))))) - NIL (GO G190) G191 (EXIT NIL)) - (EXIT 'NIL))) - #0# (EXIT #0#))))) - -(DEFUN |ILIST;concat!;3$;25| (|x| |y| $) - (PROG (|z|) - (RETURN - (SEQ (COND - ((NULL |x|) - (COND - ((NULL |y|) |x|) - ('T - (SEQ (PUSH (SPADCALL |y| (QREFELT $ 13)) |x|) - (QRPLACD |x| (SPADCALL |y| (QREFELT $ 18))) - (EXIT |x|))))) - ('T - (SEQ (LETT |z| |x| |ILIST;concat!;3$;25|) - (SEQ G190 - (COND - ((NULL (SPADCALL (NULL (QCDR |z|)) - (QREFELT $ 33))) - (GO G191))) - (SEQ (EXIT (LETT |z| (QCDR |z|) - |ILIST;concat!;3$;25|))) - NIL (GO G190) G191 (EXIT NIL)) - (QRPLACD |z| |y|) (EXIT |x|)))))))) - -(DEFUN |ILIST;removeDuplicates!;2$;26| (|l| $) - (PROG (|f| |p| |pr| |pp|) - (RETURN - (SEQ (LETT |p| |l| |ILIST;removeDuplicates!;2$;26|) - (SEQ G190 - (COND - ((NULL (SPADCALL (NULL |p|) (QREFELT $ 33))) - (GO G191))) - (SEQ (LETT |pp| |p| |ILIST;removeDuplicates!;2$;26|) - (LETT |f| (QCAR |p|) - |ILIST;removeDuplicates!;2$;26|) - (LETT |p| (QCDR |p|) - |ILIST;removeDuplicates!;2$;26|) - (EXIT (SEQ G190 - (COND - ((NULL - (SPADCALL - (NULL - (LETT |pr| (QCDR |pp|) - |ILIST;removeDuplicates!;2$;26|)) - (QREFELT $ 33))) - (GO G191))) - (SEQ (EXIT - (COND - ((SPADCALL (QCAR |pr|) |f| - (QREFELT $ 47)) - (QRPLACD |pp| (QCDR |pr|))) - ('T - (LETT |pp| |pr| - |ILIST;removeDuplicates!;2$;26|))))) - NIL (GO G190) G191 (EXIT NIL)))) - NIL (GO G190) G191 (EXIT NIL)) - (EXIT |l|))))) - -(DEFUN |ILIST;sort!;M2$;27| (|f| |l| $) - (|ILIST;mergeSort| |f| |l| (SPADCALL |l| (QREFELT $ 9)) $)) - -(DEFUN |ILIST;merge!;M3$;28| (|f| |p| |q| $) - (PROG (|r| |t|) - (RETURN - (SEQ (COND - ((NULL |p|) |q|) - ((NULL |q|) |p|) - ((EQ |p| |q|) (|error| "cannot merge a list into itself")) - ('T - (SEQ (COND - ((SPADCALL (QCAR |p|) (QCAR |q|) |f|) - (SEQ (LETT |r| - (LETT |t| |p| |ILIST;merge!;M3$;28|) - |ILIST;merge!;M3$;28|) - (EXIT (LETT |p| (QCDR |p|) - |ILIST;merge!;M3$;28|)))) - ('T - (SEQ (LETT |r| - (LETT |t| |q| |ILIST;merge!;M3$;28|) - |ILIST;merge!;M3$;28|) - (EXIT (LETT |q| (QCDR |q|) - |ILIST;merge!;M3$;28|))))) - (SEQ G190 - (COND - ((NULL (COND - ((NULL |p|) 'NIL) - ('T - (SPADCALL (NULL |q|) - (QREFELT $ 33))))) - (GO G191))) - (SEQ (EXIT (COND - ((SPADCALL (QCAR |p|) (QCAR |q|) - |f|) - (SEQ (QRPLACD |t| |p|) - (LETT |t| |p| - |ILIST;merge!;M3$;28|) - (EXIT - (LETT |p| (QCDR |p|) - |ILIST;merge!;M3$;28|)))) - ('T - (SEQ (QRPLACD |t| |q|) - (LETT |t| |q| - |ILIST;merge!;M3$;28|) - (EXIT - (LETT |q| (QCDR |q|) - |ILIST;merge!;M3$;28|))))))) - NIL (GO G190) G191 (EXIT NIL)) - (QRPLACD |t| (COND ((NULL |p|) |q|) ('T |p|))) - (EXIT |r|)))))))) - -(DEFUN |ILIST;split!;$I$;29| (|p| |n| $) - (PROG (#0=#:G1506 |q|) - (RETURN - (SEQ (COND - ((< |n| 1) (|error| "index out of range")) - ('T - (SEQ (LETT |p| - (SPADCALL |p| - (PROG1 (LETT #0# (- |n| 1) - |ILIST;split!;$I$;29|) - (|check-subtype| (>= #0# 0) - '(|NonNegativeInteger|) #0#)) - (QREFELT $ 32)) - |ILIST;split!;$I$;29|) - (LETT |q| (QCDR |p|) |ILIST;split!;$I$;29|) - (QRPLACD |p| NIL) (EXIT |q|)))))))) - -(DEFUN |ILIST;mergeSort| (|f| |p| |n| $) - (PROG (#0=#:G1510 |l| |q|) - (RETURN - (SEQ (COND - ((EQL |n| 2) - (COND - ((SPADCALL - (SPADCALL (SPADCALL |p| (QREFELT $ 18)) - (QREFELT $ 13)) - (SPADCALL |p| (QREFELT $ 13)) |f|) - (LETT |p| (SPADCALL |p| (QREFELT $ 28)) - |ILIST;mergeSort|))))) - (EXIT (COND - ((< |n| 3) |p|) - ('T - (SEQ (LETT |l| - (PROG1 (LETT #0# (QUOTIENT2 |n| 2) - |ILIST;mergeSort|) - (|check-subtype| (>= #0# 0) - '(|NonNegativeInteger|) #0#)) - |ILIST;mergeSort|) - (LETT |q| (SPADCALL |p| |l| (QREFELT $ 58)) - |ILIST;mergeSort|) - (LETT |p| (|ILIST;mergeSort| |f| |p| |l| $) - |ILIST;mergeSort|) - (LETT |q| - (|ILIST;mergeSort| |f| |q| (- |n| |l|) - $) - |ILIST;mergeSort|) - (EXIT (SPADCALL |f| |p| |q| (QREFELT $ 57))))))))))) - -(DEFUN |IndexedList| (&REST #0=#:G1525 &AUX #1=#:G1523) - (DSETQ #1# #0#) - (PROG () - (RETURN - (PROG (#2=#:G1524) - (RETURN - (COND - ((LETT #2# - (|lassocShiftWithFunction| (|devaluateList| #1#) - (HGET |$ConstructorCache| '|IndexedList|) - '|domainEqualList|) - |IndexedList|) - (|CDRwithIncrement| #2#)) - ('T - (UNWIND-PROTECT - (PROG1 (APPLY (|function| |IndexedList;|) #1#) - (LETT #2# T |IndexedList|)) - (COND - ((NOT #2#) (HREM |$ConstructorCache| '|IndexedList|))))))))))) - -(DEFUN |IndexedList;| (|#1| |#2|) - (PROG (|dv$1| |dv$2| |dv$| $ #0=#:G1522 #1=#:G1520 |pv$|) - (RETURN - (PROGN - (LETT |dv$1| (|devaluate| |#1|) . #2=(|IndexedList|)) - (LETT |dv$2| (|devaluate| |#2|) . #2#) - (LETT |dv$| (LIST '|IndexedList| |dv$1| |dv$2|) . #2#) - (LETT $ (GETREFV 72) . #2#) - (QSETREFV $ 0 |dv$|) - (QSETREFV $ 3 - (LETT |pv$| - (|buildPredVector| 0 0 - (LIST (|HasCategory| |#1| - '(|ConvertibleTo| (|InputForm|))) - (|HasCategory| |#1| '(|OrderedSet|)) - (|HasCategory| (|Integer|) '(|OrderedSet|)) - (LETT #0# - (|HasCategory| |#1| '(|SetCategory|)) . #2#) - (OR (|HasCategory| |#1| '(|OrderedSet|)) - #0#) - (AND #0# - (|HasCategory| |#1| - (LIST '|Evalable| - (|devaluate| |#1|)))) - (OR (AND (|HasCategory| |#1| - '(|OrderedSet|)) - (|HasCategory| |#1| - (LIST '|Evalable| - (|devaluate| |#1|)))) - (AND #0# - (|HasCategory| |#1| - (LIST '|Evalable| - (|devaluate| |#1|))))) - (LETT #1# - (|HasCategory| |#1| - '(|CoercibleTo| (|OutputForm|))) . #2#) - (OR (AND #0# - (|HasCategory| |#1| - (LIST '|Evalable| - (|devaluate| |#1|)))) - #1#))) . #2#)) - (|haddProp| |$ConstructorCache| '|IndexedList| - (LIST |dv$1| |dv$2|) (CONS 1 $)) - (|stuffDomainSlots| $) - (QSETREFV $ 6 |#1|) - (QSETREFV $ 7 |#2|) - (COND - ((|testBitVector| |pv$| 8) - (QSETREFV $ 46 - (CONS (|dispatchFunction| |ILIST;coerce;$Of;21|) $)))) - (COND - ((|testBitVector| |pv$| 4) - (PROGN - (QSETREFV $ 48 - (CONS (|dispatchFunction| |ILIST;=;2$B;22|) $)) - (QSETREFV $ 51 - (CONS (|dispatchFunction| |ILIST;latex;$S;23|) $)) - (QSETREFV $ 52 - (CONS (|dispatchFunction| |ILIST;member?;S$B;24|) $))))) - (COND - ((|testBitVector| |pv$| 4) - (QSETREFV $ 54 - (CONS (|dispatchFunction| - |ILIST;removeDuplicates!;2$;26|) - $)))) - $)))) - -(MAKEPROP '|IndexedList| '|infovec| - (LIST '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|) - (|NonNegativeInteger|) |ILIST;#;$Nni;1| - |ILIST;concat;S2$;2| (|Boolean|) |ILIST;eq?;2$B;3| - |ILIST;first;$S;4| '"first" |ILIST;elt;$firstS;5| - |ILIST;empty;$;6| |ILIST;empty?;$B;7| |ILIST;rest;2$;8| - '"rest" |ILIST;elt;$rest$;9| |ILIST;setfirst!;$2S;10| - |ILIST;setelt;$first2S;11| |ILIST;setrest!;3$;12| - |ILIST;setelt;$rest2$;13| (|List| 6) - |ILIST;construct;L$;14| |ILIST;parts;$L;15| - |ILIST;reverse!;2$;16| |ILIST;reverse;2$;17| (|Integer|) - |ILIST;minIndex;$I;18| |ILIST;rest;$Nni$;19| (0 . |not|) - (5 . |cyclic?|) |ILIST;copy;2$;20| (10 . |cycleEntry|) - (|OutputForm|) (15 . |coerce|) (|List| $) (20 . |bracket|) - (|List| 37) (25 . |list|) (30 . |commaSeparate|) - (35 . |overbar|) (40 . |concat!|) (46 . |coerce|) (51 . =) - (57 . =) (|String|) (63 . |latex|) (68 . |latex|) - (73 . |member?|) |ILIST;concat!;3$;25| - (79 . |removeDuplicates!|) (|Mapping| 11 6 6) - |ILIST;sort!;M2$;27| |ILIST;merge!;M3$;28| - |ILIST;split!;$I$;29| (|Mapping| 6 6 6) (|Equation| 6) - (|List| 60) (|Mapping| 11 6) (|Void|) - (|UniversalSegment| 30) '"last" '"value" (|Mapping| 6 6) - (|InputForm|) (|SingleInteger|) (|List| 30) - (|Union| 6 '"failed")) - '#(~= 84 |value| 90 |third| 95 |tail| 100 |swap!| 105 - |split!| 112 |sorted?| 118 |sort!| 129 |sort| 140 |size?| - 151 |setvalue!| 157 |setrest!| 163 |setlast!| 169 - |setfirst!| 175 |setelt| 181 |setchildren!| 223 |select!| - 229 |select| 235 |second| 241 |sample| 246 |reverse!| 250 - |reverse| 255 |rest| 260 |removeDuplicates!| 271 - |removeDuplicates| 276 |remove!| 281 |remove| 293 |reduce| - 305 |qsetelt!| 326 |qelt| 333 |possiblyInfinite?| 339 - |position| 344 |parts| 363 |nodes| 368 |node?| 373 |new| - 379 |more?| 385 |minIndex| 391 |min| 396 |merge!| 402 - |merge| 415 |members| 428 |member?| 433 |maxIndex| 439 - |max| 444 |map!| 450 |map| 456 |list| 469 |less?| 474 - |leaves| 480 |leaf?| 485 |latex| 490 |last| 495 |insert!| - 506 |insert| 520 |indices| 534 |index?| 539 |hash| 545 - |first| 550 |find| 561 |fill!| 567 |explicitlyFinite?| 573 - |every?| 578 |eval| 584 |eq?| 610 |entry?| 616 |entries| - 622 |empty?| 627 |empty| 632 |elt| 636 |distance| 679 - |delete!| 685 |delete| 697 |cyclic?| 709 |cycleTail| 714 - |cycleSplit!| 719 |cycleLength| 724 |cycleEntry| 729 - |count| 734 |copyInto!| 746 |copy| 753 |convert| 758 - |construct| 763 |concat!| 768 |concat| 780 |coerce| 803 - |children| 808 |child?| 813 |any?| 819 >= 825 > 831 = 837 - <= 843 < 849 |#| 855) - '((|shallowlyMutable| . 0) (|finiteAggregate| . 0)) - (CONS (|makeByteWordVec2| 9 - '(0 0 0 0 0 0 0 0 0 0 2 0 0 7 5 0 0 7 9 1 5)) - (CONS '#(|ListAggregate&| |StreamAggregate&| - |ExtensibleLinearAggregate&| - |FiniteLinearAggregate&| - |UnaryRecursiveAggregate&| |LinearAggregate&| - |RecursiveAggregate&| |IndexedAggregate&| - |Collection&| |HomogeneousAggregate&| - |OrderedSet&| |Aggregate&| |EltableAggregate&| - |Evalable&| |SetCategory&| NIL NIL - |InnerEvalable&| NIL NIL |BasicType&|) - (CONS '#((|ListAggregate| 6) - (|StreamAggregate| 6) - (|ExtensibleLinearAggregate| 6) - (|FiniteLinearAggregate| 6) - (|UnaryRecursiveAggregate| 6) - (|LinearAggregate| 6) - (|RecursiveAggregate| 6) - (|IndexedAggregate| 30 6) - (|Collection| 6) - (|HomogeneousAggregate| 6) - (|OrderedSet|) (|Aggregate|) - (|EltableAggregate| 30 6) (|Evalable| 6) - (|SetCategory|) (|Type|) - (|Eltable| 30 6) (|InnerEvalable| 6 6) - (|CoercibleTo| 37) (|ConvertibleTo| 68) - (|BasicType|)) - (|makeByteWordVec2| 71 - '(1 11 0 0 33 1 0 11 0 34 1 0 0 0 36 1 - 6 37 0 38 1 37 0 39 40 1 41 0 37 42 1 - 37 0 39 43 1 37 0 0 44 2 41 0 0 37 45 - 1 0 37 0 46 2 6 11 0 0 47 2 0 11 0 0 - 48 1 6 49 0 50 1 0 49 0 51 2 0 11 6 0 - 52 1 0 0 0 54 2 4 11 0 0 1 1 0 6 0 1 - 1 0 6 0 1 1 0 0 0 1 3 0 63 0 30 30 1 - 2 0 0 0 30 58 1 2 11 0 1 2 0 11 55 0 - 1 1 2 0 0 1 2 0 0 55 0 56 1 2 0 0 1 2 - 0 0 55 0 1 2 0 11 0 8 1 2 0 6 0 6 1 2 - 0 0 0 0 23 2 0 6 0 6 1 2 0 6 0 6 21 3 - 0 6 0 30 6 1 3 0 6 0 64 6 1 3 0 6 0 - 65 6 1 3 0 0 0 19 0 24 3 0 6 0 14 6 - 22 3 0 6 0 66 6 1 2 0 0 0 39 1 2 0 0 - 62 0 1 2 0 0 62 0 1 1 0 6 0 1 0 0 0 1 - 1 0 0 0 28 1 0 0 0 29 2 0 0 0 8 32 1 - 0 0 0 18 1 4 0 0 54 1 4 0 0 1 2 4 0 6 - 0 1 2 0 0 62 0 1 2 4 0 6 0 1 2 0 0 62 - 0 1 4 4 6 59 0 6 6 1 2 0 6 59 0 1 3 0 - 6 59 0 6 1 3 0 6 0 30 6 1 2 0 6 0 30 - 1 1 0 11 0 1 2 4 30 6 0 1 3 4 30 6 0 - 30 1 2 0 30 62 0 1 1 0 25 0 27 1 0 39 - 0 1 2 4 11 0 0 1 2 0 0 8 6 1 2 0 11 0 - 8 1 1 3 30 0 31 2 2 0 0 0 1 2 2 0 0 0 - 1 3 0 0 55 0 0 57 2 2 0 0 0 1 3 0 0 - 55 0 0 1 1 0 25 0 1 2 4 11 6 0 52 1 3 - 30 0 1 2 2 0 0 0 1 2 0 0 67 0 1 3 0 0 - 59 0 0 1 2 0 0 67 0 1 1 0 0 6 1 2 0 - 11 0 8 1 1 0 25 0 1 1 0 11 0 1 1 4 49 - 0 51 2 0 0 0 8 1 1 0 6 0 1 3 0 0 6 0 - 30 1 3 0 0 0 0 30 1 3 0 0 0 0 30 1 3 - 0 0 6 0 30 1 1 0 70 0 1 2 0 11 30 0 1 - 1 4 69 0 1 2 0 0 0 8 1 1 0 6 0 13 2 0 - 71 62 0 1 2 0 0 0 6 1 1 0 11 0 1 2 0 - 11 62 0 1 3 6 0 0 6 6 1 3 6 0 0 25 25 - 1 2 6 0 0 60 1 2 6 0 0 61 1 2 0 11 0 - 0 12 2 4 11 6 0 1 1 0 25 0 1 1 0 11 0 - 17 0 0 0 16 2 0 6 0 30 1 3 0 6 0 30 6 - 1 2 0 0 0 64 1 2 0 6 0 65 1 2 0 0 0 - 19 20 2 0 6 0 14 15 2 0 6 0 66 1 2 0 - 30 0 0 1 2 0 0 0 64 1 2 0 0 0 30 1 2 - 0 0 0 64 1 2 0 0 0 30 1 1 0 11 0 34 1 - 0 0 0 1 1 0 0 0 1 1 0 8 0 1 1 0 0 0 - 36 2 4 8 6 0 1 2 0 8 62 0 1 3 0 0 0 0 - 30 1 1 0 0 0 35 1 1 68 0 1 1 0 0 25 - 26 2 0 0 0 0 53 2 0 0 0 6 1 1 0 0 39 - 1 2 0 0 0 6 1 2 0 0 6 0 10 2 0 0 0 0 - 1 1 8 37 0 46 1 0 39 0 1 2 4 11 0 0 1 - 2 0 11 62 0 1 2 2 11 0 0 1 2 2 11 0 0 - 1 2 4 11 0 0 48 2 2 11 0 0 1 2 2 11 0 - 0 1 1 0 8 0 9))))) - '|lookupComplete|)) -@ \section{domain LIST List} <<domain LIST List>>= )abbrev domain LIST List @@ -970,320 +338,7 @@ List(S:Type): Exports == Implementation where [convert a for a in (x pretend List S)]$List(InputForm)) @ -\section{LIST.lsp BOOTSTRAP} -{\bf LIST} depends on a chain of -files. We need to break this cycle to build the algebra. So we keep a -cached copy of the translated {\bf LIST} category which we can write -into the {\bf MID} directory. We compile the lisp code and copy the -{\bf LIST.o} file to the {\bf OUT} directory. This is eventually -forcibly replaced by a recompiled version. - -Note that this code is not included in the generated catdef.spad file. - -<<LIST.lsp BOOTSTRAP>>= - -(/VERSIONCHECK 2) - -(PUT '|LIST;nil;$;1| '|SPADreplace| '(XLAM NIL NIL)) - -(DEFUN |LIST;nil;$;1| ($) NIL) -(PUT '|LIST;null;$B;2| '|SPADreplace| 'NULL) - -(DEFUN |LIST;null;$B;2| (|l| $) (NULL |l|)) - -(PUT '|LIST;cons;S2$;3| '|SPADreplace| 'CONS) - -(DEFUN |LIST;cons;S2$;3| (|s| |l| $) (CONS |s| |l|)) - -(PUT '|LIST;append;3$;4| '|SPADreplace| 'APPEND) - -(DEFUN |LIST;append;3$;4| (|l| |t| $) (APPEND |l| |t|)) - -(DEFUN |LIST;writeOMList| (|dev| |x| $) - (SEQ (SPADCALL |dev| (QREFELT $ 14)) - (SPADCALL |dev| "list1" "list" (QREFELT $ 16)) - (SEQ G190 - (COND - ((NULL (SPADCALL (NULL |x|) (QREFELT $ 17))) (GO G191))) - (SEQ (SPADCALL |dev| (|SPADfirst| |x|) 'NIL (QREFELT $ 18)) - (EXIT (LETT |x| (CDR |x|) |LIST;writeOMList|))) - NIL (GO G190) G191 (EXIT NIL)) - (EXIT (SPADCALL |dev| (QREFELT $ 19))))) - -(DEFUN |LIST;OMwrite;$S;6| (|x| $) - (PROG (|sp| |dev| |s|) - (RETURN - (SEQ (LETT |s| "" |LIST;OMwrite;$S;6|) - (LETT |sp| (OM-STRINGTOSTRINGPTR |s|) |LIST;OMwrite;$S;6|) - (LETT |dev| - (SPADCALL |sp| (SPADCALL (QREFELT $ 21)) - (QREFELT $ 22)) - |LIST;OMwrite;$S;6|) - (SPADCALL |dev| (QREFELT $ 23)) - (|LIST;writeOMList| |dev| |x| $) - (SPADCALL |dev| (QREFELT $ 24)) - (SPADCALL |dev| (QREFELT $ 25)) - (LETT |s| (OM-STRINGPTRTOSTRING |sp|) |LIST;OMwrite;$S;6|) - (EXIT |s|))))) - -(DEFUN |LIST;OMwrite;$BS;7| (|x| |wholeObj| $) - (PROG (|sp| |dev| |s|) - (RETURN - (SEQ (LETT |s| "" |LIST;OMwrite;$BS;7|) - (LETT |sp| (OM-STRINGTOSTRINGPTR |s|) |LIST;OMwrite;$BS;7|) - (LETT |dev| - (SPADCALL |sp| (SPADCALL (QREFELT $ 21)) - (QREFELT $ 22)) - |LIST;OMwrite;$BS;7|) - (COND (|wholeObj| (SPADCALL |dev| (QREFELT $ 23)))) - (|LIST;writeOMList| |dev| |x| $) - (COND (|wholeObj| (SPADCALL |dev| (QREFELT $ 24)))) - (SPADCALL |dev| (QREFELT $ 25)) - (LETT |s| (OM-STRINGPTRTOSTRING |sp|) |LIST;OMwrite;$BS;7|) - (EXIT |s|))))) - -(DEFUN |LIST;OMwrite;Omd$V;8| (|dev| |x| $) - (SEQ (SPADCALL |dev| (QREFELT $ 23)) (|LIST;writeOMList| |dev| |x| $) - (EXIT (SPADCALL |dev| (QREFELT $ 24))))) - -(DEFUN |LIST;OMwrite;Omd$BV;9| (|dev| |x| |wholeObj| $) - (SEQ (COND (|wholeObj| (SPADCALL |dev| (QREFELT $ 23)))) - (|LIST;writeOMList| |dev| |x| $) - (EXIT (COND (|wholeObj| (SPADCALL |dev| (QREFELT $ 24))))))) - -(DEFUN |LIST;setUnion;3$;10| (|l1| |l2| $) - (SPADCALL (SPADCALL |l1| |l2| (QREFELT $ 30)) (QREFELT $ 31))) - -(DEFUN |LIST;setIntersection;3$;11| (|l1| |l2| $) - (PROG (|u|) - (RETURN - (SEQ (LETT |u| NIL |LIST;setIntersection;3$;11|) - (LETT |l1| (SPADCALL |l1| (QREFELT $ 31)) - |LIST;setIntersection;3$;11|) - (SEQ G190 - (COND - ((NULL (SPADCALL (NULL |l1|) (QREFELT $ 17))) - (GO G191))) - (SEQ (COND - ((SPADCALL (|SPADfirst| |l1|) |l2| - (QREFELT $ 33)) - (LETT |u| (CONS (|SPADfirst| |l1|) |u|) - |LIST;setIntersection;3$;11|))) - (EXIT (LETT |l1| (CDR |l1|) - |LIST;setIntersection;3$;11|))) - NIL (GO G190) G191 (EXIT NIL)) - (EXIT |u|))))) - -(DEFUN |LIST;setDifference;3$;12| (|l1| |l2| $) - (PROG (|l11| |lu|) - (RETURN - (SEQ (LETT |l1| (SPADCALL |l1| (QREFELT $ 31)) - |LIST;setDifference;3$;12|) - (LETT |lu| NIL |LIST;setDifference;3$;12|) - (SEQ G190 - (COND - ((NULL (SPADCALL (NULL |l1|) (QREFELT $ 17))) - (GO G191))) - (SEQ (LETT |l11| (SPADCALL |l1| 1 (QREFELT $ 36)) - |LIST;setDifference;3$;12|) - (COND - ((NULL (SPADCALL |l11| |l2| (QREFELT $ 33))) - (LETT |lu| (CONS |l11| |lu|) - |LIST;setDifference;3$;12|))) - (EXIT (LETT |l1| (CDR |l1|) - |LIST;setDifference;3$;12|))) - NIL (GO G190) G191 (EXIT NIL)) - (EXIT |lu|))))) - -(DEFUN |LIST;convert;$If;13| (|x| $) - (PROG (#0=#:G1440 |a| #1=#:G1441) - (RETURN - (SEQ (SPADCALL - (CONS (SPADCALL (SPADCALL "construct" (QREFELT $ 39)) - (QREFELT $ 41)) - (PROGN - (LETT #0# NIL |LIST;convert;$If;13|) - (SEQ (LETT |a| NIL |LIST;convert;$If;13|) - (LETT #1# |x| |LIST;convert;$If;13|) G190 - (COND - ((OR (ATOM #1#) - (PROGN - (LETT |a| (CAR #1#) - |LIST;convert;$If;13|) - NIL)) - (GO G191))) - (SEQ (EXIT (LETT #0# - (CONS - (SPADCALL |a| (QREFELT $ 42)) - #0#) - |LIST;convert;$If;13|))) - (LETT #1# (CDR #1#) |LIST;convert;$If;13|) - (GO G190) G191 (EXIT (NREVERSE0 #0#))))) - (QREFELT $ 44)))))) - -(DEFUN |List| (#0=#:G1452) - (PROG () - (RETURN - (PROG (#1=#:G1453) - (RETURN - (COND - ((LETT #1# - (|lassocShiftWithFunction| (LIST (|devaluate| #0#)) - (HGET |$ConstructorCache| '|List|) - '|domainEqualList|) - |List|) - (|CDRwithIncrement| #1#)) - ('T - (UNWIND-PROTECT - (PROG1 (|List;| #0#) (LETT #1# T |List|)) - (COND ((NOT #1#) (HREM |$ConstructorCache| '|List|))))))))))) - -(DEFUN |List;| (|#1|) - (PROG (|dv$1| |dv$| $ #0=#:G1451 #1=#:G1449 |pv$|) - (RETURN - (PROGN - (LETT |dv$1| (|devaluate| |#1|) . #2=(|List|)) - (LETT |dv$| (LIST '|List| |dv$1|) . #2#) - (LETT $ (GETREFV 63) . #2#) - (QSETREFV $ 0 |dv$|) - (QSETREFV $ 3 - (LETT |pv$| - (|buildPredVector| 0 0 - (LIST (|HasCategory| |#1| - '(|ConvertibleTo| (|InputForm|))) - (|HasCategory| |#1| '(|OrderedSet|)) - (|HasCategory| |#1| '(|OpenMath|)) - (|HasCategory| (|Integer|) '(|OrderedSet|)) - (LETT #0# - (|HasCategory| |#1| '(|SetCategory|)) . #2#) - (OR (|HasCategory| |#1| '(|OrderedSet|)) - #0#) - (AND #0# - (|HasCategory| |#1| - (LIST '|Evalable| - (|devaluate| |#1|)))) - (OR (AND (|HasCategory| |#1| - '(|OrderedSet|)) - (|HasCategory| |#1| - (LIST '|Evalable| - (|devaluate| |#1|)))) - (AND #0# - (|HasCategory| |#1| - (LIST '|Evalable| - (|devaluate| |#1|))))) - (LETT #1# - (|HasCategory| |#1| - '(|CoercibleTo| (|OutputForm|))) . #2#) - (OR (AND #0# - (|HasCategory| |#1| - (LIST '|Evalable| - (|devaluate| |#1|)))) - #1#))) . #2#)) - (|haddProp| |$ConstructorCache| '|List| (LIST |dv$1|) - (CONS 1 $)) - (|stuffDomainSlots| $) - (QSETREFV $ 6 |#1|) - (COND - ((|testBitVector| |pv$| 3) - (PROGN - (QSETREFV $ 26 - (CONS (|dispatchFunction| |LIST;OMwrite;$S;6|) $)) - (QSETREFV $ 27 - (CONS (|dispatchFunction| |LIST;OMwrite;$BS;7|) $)) - (QSETREFV $ 28 - (CONS (|dispatchFunction| |LIST;OMwrite;Omd$V;8|) $)) - (QSETREFV $ 29 - (CONS (|dispatchFunction| |LIST;OMwrite;Omd$BV;9|) $))))) - (COND - ((|testBitVector| |pv$| 5) - (PROGN - (QSETREFV $ 32 - (CONS (|dispatchFunction| |LIST;setUnion;3$;10|) $)) - (QSETREFV $ 34 - (CONS (|dispatchFunction| - |LIST;setIntersection;3$;11|) - $)) - (QSETREFV $ 37 - (CONS (|dispatchFunction| |LIST;setDifference;3$;12|) - $))))) - (COND - ((|testBitVector| |pv$| 1) - (QSETREFV $ 45 - (CONS (|dispatchFunction| |LIST;convert;$If;13|) $)))) - $)))) - -(MAKEPROP '|List| '|infovec| - (LIST '#(NIL NIL NIL NIL NIL (|IndexedList| 6 (NRTEVAL 1)) - (|local| |#1|) |LIST;nil;$;1| (|Boolean|) |LIST;null;$B;2| - |LIST;cons;S2$;3| |LIST;append;3$;4| (|Void|) - (|OpenMathDevice|) (0 . |OMputApp|) (|String|) - (5 . |OMputSymbol|) (12 . |not|) (17 . |OMwrite|) - (24 . |OMputEndApp|) (|OpenMathEncoding|) - (29 . |OMencodingXML|) (33 . |OMopenString|) - (39 . |OMputObject|) (44 . |OMputEndObject|) - (49 . |OMclose|) (54 . |OMwrite|) (59 . |OMwrite|) - (65 . |OMwrite|) (71 . |OMwrite|) (78 . |concat|) - (84 . |removeDuplicates|) (89 . |setUnion|) - (95 . |member?|) (101 . |setIntersection|) (|Integer|) - (107 . |elt|) (113 . |setDifference|) (|Symbol|) - (119 . |coerce|) (|InputForm|) (124 . |convert|) - (129 . |convert|) (|List| $) (134 . |convert|) - (139 . |convert|) (|Mapping| 6 6 6) (|NonNegativeInteger|) - (|List| 6) (|List| 50) (|Equation| 6) (|Mapping| 8 6) - (|Mapping| 8 6 6) (|UniversalSegment| 35) '"last" '"rest" - '"first" '"value" (|Mapping| 6 6) (|OutputForm|) - (|SingleInteger|) (|List| 35) (|Union| 6 '"failed")) - '#(|setUnion| 144 |setIntersection| 150 |setDifference| 156 - |removeDuplicates| 162 |null| 167 |nil| 172 |member?| 176 - |elt| 182 |convert| 188 |cons| 193 |concat| 199 |append| - 205 |OMwrite| 211) - '((|shallowlyMutable| . 0) (|finiteAggregate| . 0)) - (CONS (|makeByteWordVec2| 10 - '(0 0 0 0 0 0 0 0 0 0 2 0 0 8 6 0 0 8 10 1 6 3)) - (CONS '#(|ListAggregate&| |StreamAggregate&| - |ExtensibleLinearAggregate&| - |FiniteLinearAggregate&| - |UnaryRecursiveAggregate&| |LinearAggregate&| - |RecursiveAggregate&| |IndexedAggregate&| - |Collection&| |HomogeneousAggregate&| - |OrderedSet&| |Aggregate&| |EltableAggregate&| - |Evalable&| |SetCategory&| NIL NIL - |InnerEvalable&| NIL NIL |BasicType&| NIL) - (CONS '#((|ListAggregate| 6) - (|StreamAggregate| 6) - (|ExtensibleLinearAggregate| 6) - (|FiniteLinearAggregate| 6) - (|UnaryRecursiveAggregate| 6) - (|LinearAggregate| 6) - (|RecursiveAggregate| 6) - (|IndexedAggregate| 35 6) - (|Collection| 6) - (|HomogeneousAggregate| 6) - (|OrderedSet|) (|Aggregate|) - (|EltableAggregate| 35 6) (|Evalable| 6) - (|SetCategory|) (|Type|) - (|Eltable| 35 6) (|InnerEvalable| 6 6) - (|CoercibleTo| 59) (|ConvertibleTo| 40) - (|BasicType|) (|OpenMath|)) - (|makeByteWordVec2| 45 - '(1 13 12 0 14 3 13 12 0 15 15 16 1 8 0 - 0 17 3 6 12 13 0 8 18 1 13 12 0 19 0 - 20 0 21 2 13 0 15 20 22 1 13 12 0 23 - 1 13 12 0 24 1 13 12 0 25 1 0 15 0 26 - 2 0 15 0 8 27 2 0 12 13 0 28 3 0 12 - 13 0 8 29 2 0 0 0 0 30 1 0 0 0 31 2 0 - 0 0 0 32 2 0 8 6 0 33 2 0 0 0 0 34 2 - 0 6 0 35 36 2 0 0 0 0 37 1 38 0 15 39 - 1 40 0 38 41 1 6 40 0 42 1 40 0 43 44 - 1 0 40 0 45 2 5 0 0 0 32 2 5 0 0 0 34 - 2 5 0 0 0 37 1 5 0 0 31 1 0 8 0 9 0 0 - 0 7 2 5 8 6 0 33 2 0 6 0 35 36 1 1 40 - 0 45 2 0 0 6 0 10 2 0 0 0 0 30 2 0 0 - 0 0 11 3 3 12 13 0 8 29 2 3 12 13 0 - 28 1 3 15 0 26 2 3 15 0 8 27))))) - '|lookupIncomplete|)) -@ \section{package LIST2 ListFunctions2} <<package LIST2 ListFunctions2>>= )abbrev package LIST2 ListFunctions2 |