diff options
Diffstat (limited to 'src/algebra/array1.spad.pamphlet')
-rw-r--r-- | src/algebra/array1.spad.pamphlet | 229 |
1 files changed, 190 insertions, 39 deletions
diff --git a/src/algebra/array1.spad.pamphlet b/src/algebra/array1.spad.pamphlet index a304c91a..86fe6cb6 100644 --- a/src/algebra/array1.spad.pamphlet +++ b/src/algebra/array1.spad.pamphlet @@ -46,47 +46,198 @@ Note that this code is not included in the generated catdef.spad file. <<PRIMARR.lsp BOOTSTRAP>>= -(|/VERSIONCHECK| 2) - -(PUT (QUOTE |PRIMARR;#;$Nni;1|) (QUOTE |SPADreplace|) (QUOTE QVSIZE)) - -(DEFUN |PRIMARR;#;$Nni;1| (|x| |$|) (QVSIZE |x|)) - -(PUT (QUOTE |PRIMARR;minIndex;$I;2|) (QUOTE |SPADreplace|) (QUOTE (XLAM (|x|) 0))) - -(DEFUN |PRIMARR;minIndex;$I;2| (|x| |$|) 0) - -(PUT (QUOTE |PRIMARR;empty;$;3|) (QUOTE |SPADreplace|) (QUOTE (XLAM NIL (GETREFV 0)))) - -(DEFUN |PRIMARR;empty;$;3| (|$|) (GETREFV 0)) - -(DEFUN |PRIMARR;new;NniS$;4| (|n| |x| |$|) (SPADCALL (GETREFV |n|) |x| (QREFELT |$| 12))) - -(PUT (QUOTE |PRIMARR;qelt;$IS;5|) (QUOTE |SPADreplace|) (QUOTE ELT)) - -(DEFUN |PRIMARR;qelt;$IS;5| (|x| |i| |$|) (ELT |x| |i|)) - -(PUT (QUOTE |PRIMARR;elt;$IS;6|) (QUOTE |SPADreplace|) (QUOTE ELT)) - -(DEFUN |PRIMARR;elt;$IS;6| (|x| |i| |$|) (ELT |x| |i|)) - -(PUT (QUOTE |PRIMARR;qsetelt!;$I2S;7|) (QUOTE |SPADreplace|) (QUOTE SETELT)) - -(DEFUN |PRIMARR;qsetelt!;$I2S;7| (|x| |i| |s| |$|) (SETELT |x| |i| |s|)) - -(PUT (QUOTE |PRIMARR;setelt;$I2S;8|) (QUOTE |SPADreplace|) (QUOTE SETELT)) - -(DEFUN |PRIMARR;setelt;$I2S;8| (|x| |i| |s| |$|) (SETELT |x| |i| |s|)) - -(DEFUN |PRIMARR;fill!;$S$;9| (|x| |s| |$|) (PROG (|i| #1=#:G82338) (RETURN (SEQ (SEQ (LETT |i| 0 |PRIMARR;fill!;$S$;9|) (LETT #1# (QVMAXINDEX |x|) |PRIMARR;fill!;$S$;9|) G190 (COND ((QSGREATERP |i| #1#) (GO G191))) (SEQ (EXIT (SETELT |x| |i| |s|))) (LETT |i| (QSADD1 |i|) |PRIMARR;fill!;$S$;9|) (GO G190) G191 (EXIT NIL)) (EXIT |x|))))) - -(DEFUN |PrimitiveArray| (#1=#:G82348) (PROG NIL (RETURN (PROG (#2=#:G82349) (RETURN (COND ((LETT #2# (|lassocShiftWithFunction| (LIST (|devaluate| #1#)) (HGET |$ConstructorCache| (QUOTE |PrimitiveArray|)) (QUOTE |domainEqualList|)) |PrimitiveArray|) (|CDRwithIncrement| #2#)) ((QUOTE T) (|UNWIND-PROTECT| (PROG1 (|PrimitiveArray;| #1#) (LETT #2# T |PrimitiveArray|)) (COND ((NOT #2#) (HREM |$ConstructorCache| (QUOTE |PrimitiveArray|)))))))))))) - -(DEFUN |PrimitiveArray;| (|#1|) (PROG (|DV$1| |dv$| |$| #1=#:G82347 |pv$|) (RETURN (PROGN (LETT |DV$1| (|devaluate| |#1|) . #2=(|PrimitiveArray|)) (LETT |dv$| (LIST (QUOTE |PrimitiveArray|) |DV$1|) . #2#) (LETT |$| (GETREFV 35) . #2#) (QSETREFV |$| 0 |dv$|) (QSETREFV |$| 3 (LETT |pv$| (|buildPredVector| 0 0 (LIST (|HasCategory| |#1| (QUOTE (|SetCategory|))) (|HasCategory| |#1| (QUOTE (|ConvertibleTo| (|InputForm|)))) (LETT #1# (|HasCategory| |#1| (QUOTE (|OrderedSet|))) . #2#) (OR #1# (|HasCategory| |#1| (QUOTE (|SetCategory|)))) (|HasCategory| (|Integer|) (QUOTE (|OrderedSet|))) (AND (|HasCategory| |#1| (LIST (QUOTE |Evalable|) (|devaluate| |#1|))) (|HasCategory| |#1| (QUOTE (|SetCategory|)))) (OR (AND (|HasCategory| |#1| (LIST (QUOTE |Evalable|) (|devaluate| |#1|))) #1#) (AND (|HasCategory| |#1| (LIST (QUOTE |Evalable|) (|devaluate| |#1|))) (|HasCategory| |#1| (QUOTE (|SetCategory|))))))) . #2#)) (|haddProp| |$ConstructorCache| (QUOTE |PrimitiveArray|) (LIST |DV$1|) (CONS 1 |$|)) (|stuffDomainSlots| |$|) (QSETREFV |$| 6 |#1|) |$|)))) - -(MAKEPROP (QUOTE |PrimitiveArray|) (QUOTE |infovec|) (LIST (QUOTE #(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|NonNegativeInteger|) |PRIMARR;#;$Nni;1| (|Integer|) |PRIMARR;minIndex;$I;2| |PRIMARR;empty;$;3| |PRIMARR;fill!;$S$;9| |PRIMARR;new;NniS$;4| |PRIMARR;qelt;$IS;5| |PRIMARR;elt;$IS;6| |PRIMARR;qsetelt!;$I2S;7| |PRIMARR;setelt;$I2S;8| (|Mapping| 6 6 6) (|Boolean|) (|List| 6) (|Equation| 6) (|List| 21) (|Mapping| 19 6) (|Mapping| 19 6 6) (|UniversalSegment| 9) (|Void|) (|Mapping| 6 6) (|InputForm|) (|OutputForm|) (|String|) (|SingleInteger|) (|List| |$|) (|Union| 6 (QUOTE "failed")) (|List| 9))) (QUOTE #(|~=| 0 |swap!| 6 |sorted?| 13 |sort!| 24 |sort| 35 |size?| 46 |setelt| 52 |select| 66 |sample| 72 |reverse!| 76 |reverse| 81 |removeDuplicates| 86 |remove| 91 |reduce| 103 |qsetelt!| 124 |qelt| 131 |position| 137 |parts| 156 |new| 161 |more?| 167 |minIndex| 173 |min| 178 |merge| 184 |members| 197 |member?| 202 |maxIndex| 208 |max| 213 |map!| 219 |map| 225 |less?| 238 |latex| 244 |insert| 249 |indices| 263 |index?| 268 |hash| 274 |first| 279 |find| 284 |fill!| 290 |every?| 296 |eval| 302 |eq?| 328 |entry?| 334 |entries| 340 |empty?| 345 |empty| 350 |elt| 354 |delete| 373 |count| 385 |copyInto!| 397 |copy| 404 |convert| 409 |construct| 414 |concat| 419 |coerce| 442 |any?| 447 |>=| 453 |>| 459 |=| 465 |<=| 471 |<| 477 |#| 483)) (QUOTE ((|shallowlyMutable| . 0) (|finiteAggregate| . 0))) (CONS (|makeByteWordVec2| 7 (QUOTE (0 0 0 0 0 0 3 0 0 7 4 0 0 7 1 2 4))) (CONS (QUOTE #(|OneDimensionalArrayAggregate&| |FiniteLinearAggregate&| |LinearAggregate&| |IndexedAggregate&| |Collection&| |HomogeneousAggregate&| |OrderedSet&| |Aggregate&| |EltableAggregate&| |Evalable&| |SetCategory&| NIL NIL |InnerEvalable&| NIL NIL |BasicType&|)) (CONS (QUOTE #((|OneDimensionalArrayAggregate| 6) (|FiniteLinearAggregate| 6) (|LinearAggregate| 6) (|IndexedAggregate| 9 6) (|Collection| 6) (|HomogeneousAggregate| 6) (|OrderedSet|) (|Aggregate|) (|EltableAggregate| 9 6) (|Evalable| 6) (|SetCategory|) (|Type|) (|Eltable| 9 6) (|InnerEvalable| 6 6) (|CoercibleTo| 29) (|ConvertibleTo| 28) (|BasicType|))) (|makeByteWordVec2| 34 (QUOTE (2 1 19 0 0 1 3 0 26 0 9 9 1 1 3 19 0 1 2 0 19 24 0 1 1 3 0 0 1 2 0 0 24 0 1 1 3 0 0 1 2 0 0 24 0 1 2 0 19 0 7 1 3 0 6 0 25 6 1 3 0 6 0 9 6 17 2 0 0 23 0 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 1 0 0 1 2 1 0 6 0 1 2 0 0 23 0 1 4 1 6 18 0 6 6 1 3 0 6 18 0 6 1 2 0 6 18 0 1 3 0 6 0 9 6 16 2 0 6 0 9 14 2 1 9 6 0 1 3 1 9 6 0 9 1 2 0 9 23 0 1 1 0 20 0 1 2 0 0 7 6 13 2 0 19 0 7 1 1 5 9 0 10 2 3 0 0 0 1 2 3 0 0 0 1 3 0 0 24 0 0 1 1 0 20 0 1 2 1 19 6 0 1 1 5 9 0 1 2 3 0 0 0 1 2 0 0 27 0 1 3 0 0 18 0 0 1 2 0 0 27 0 1 2 0 19 0 7 1 1 1 30 0 1 3 0 0 0 0 9 1 3 0 0 6 0 9 1 1 0 34 0 1 2 0 19 9 0 1 1 1 31 0 1 1 5 6 0 1 2 0 33 23 0 1 2 0 0 0 6 12 2 0 19 23 0 1 3 6 0 0 20 20 1 2 6 0 0 21 1 3 6 0 0 6 6 1 2 6 0 0 22 1 2 0 19 0 0 1 2 1 19 6 0 1 1 0 20 0 1 1 0 19 0 1 0 0 0 11 2 0 0 0 25 1 2 0 6 0 9 15 3 0 6 0 9 6 1 2 0 0 0 9 1 2 0 0 0 25 1 2 1 7 6 0 1 2 0 7 23 0 1 3 0 0 0 0 9 1 1 0 0 0 1 1 2 28 0 1 1 0 0 20 1 1 0 0 32 1 2 0 0 6 0 1 2 0 0 0 0 1 2 0 0 0 6 1 1 1 29 0 1 2 0 19 23 0 1 2 3 19 0 0 1 2 3 19 0 0 1 2 1 19 0 0 1 2 3 19 0 0 1 2 3 19 0 0 1 1 0 7 0 8)))))) (QUOTE |lookupComplete|))) +(/VERSIONCHECK 2) + +(PUT '|PRIMARR;#;$Nni;1| '|SPADreplace| 'QVSIZE) + +(DEFUN |PRIMARR;#;$Nni;1| (|x| $) (QVSIZE |x|)) + +(PUT '|PRIMARR;minIndex;$I;2| '|SPADreplace| '(XLAM (|x|) 0)) + +(DEFUN |PRIMARR;minIndex;$I;2| (|x| $) 0) + +(PUT '|PRIMARR;empty;$;3| '|SPADreplace| '(XLAM NIL (GETREFV 0))) + +(DEFUN |PRIMARR;empty;$;3| ($) (GETREFV 0)) + +(DEFUN |PRIMARR;new;NniS$;4| (|n| |x| $) + (SPADCALL (GETREFV |n|) |x| (|getShellEntry| $ 12))) + +(PUT '|PRIMARR;qelt;$IS;5| '|SPADreplace| 'ELT) + +(DEFUN |PRIMARR;qelt;$IS;5| (|x| |i| $) (ELT |x| |i|)) + +(PUT '|PRIMARR;elt;$IS;6| '|SPADreplace| 'ELT) + +(DEFUN |PRIMARR;elt;$IS;6| (|x| |i| $) (ELT |x| |i|)) + +(PUT '|PRIMARR;qsetelt!;$I2S;7| '|SPADreplace| 'SETELT) + +(DEFUN |PRIMARR;qsetelt!;$I2S;7| (|x| |i| |s| $) (SETELT |x| |i| |s|)) + +(PUT '|PRIMARR;setelt;$I2S;8| '|SPADreplace| 'SETELT) + +(DEFUN |PRIMARR;setelt;$I2S;8| (|x| |i| |s| $) (SETELT |x| |i| |s|)) + +(DEFUN |PRIMARR;fill!;$S$;9| (|x| |s| $) + (PROG (|i| #0=#:G1403) + (RETURN + (SEQ (SEQ (LETT |i| 0 |PRIMARR;fill!;$S$;9|) + (LETT #0# (QVMAXINDEX |x|) |PRIMARR;fill!;$S$;9|) G190 + (COND ((QSGREATERP |i| #0#) (GO G191))) + (SEQ (EXIT (SETELT |x| |i| |s|))) + (LETT |i| (QSADD1 |i|) |PRIMARR;fill!;$S$;9|) (GO G190) + G191 (EXIT NIL)) + (EXIT |x|))))) + +(DEFUN |PrimitiveArray| (#0=#:G1411) + (PROG () + (RETURN + (PROG (#1=#:G1412) + (RETURN + (COND + ((LETT #1# + (|lassocShiftWithFunction| (LIST (|devaluate| #0#)) + (HGET |$ConstructorCache| '|PrimitiveArray|) + '|domainEqualList|) + |PrimitiveArray|) + (|CDRwithIncrement| #1#)) + ('T + (UNWIND-PROTECT + (PROG1 (|PrimitiveArray;| #0#) + (LETT #1# T |PrimitiveArray|)) + (COND + ((NOT #1#) + (HREM |$ConstructorCache| '|PrimitiveArray|))))))))))) + +(DEFUN |PrimitiveArray;| (|#1|) + (PROG (|dv$1| |dv$| $ |pv$|) + (RETURN + (PROGN + (LETT |dv$1| (|devaluate| |#1|) . #0=(|PrimitiveArray|)) + (LETT |dv$| (LIST '|PrimitiveArray| |dv$1|) . #0#) + (LETT $ (|newShell| 35) . #0#) + (|setShellEntry| $ 0 |dv$|) + (|setShellEntry| $ 3 + (LETT |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| + '(|CoercibleTo| (|OutputForm|)))) + (|HasCategory| |#1| + '(|ConvertibleTo| (|InputForm|))) + (OR (|HasCategory| |#1| '(|OrderedSet|)) + (|HasCategory| |#1| '(|SetCategory|))) + (|HasCategory| |#1| '(|OrderedSet|)) + (|HasCategory| (|Integer|) '(|OrderedSet|)) + (|HasCategory| |#1| '(|SetCategory|)) + (AND (|HasCategory| |#1| '(|SetCategory|)) + (|HasCategory| |#1| + (LIST '|Evalable| + (|devaluate| |#1|)))) + (|HasCategory| |#1| + '(|CoercibleTo| (|OutputForm|))))) . #0#)) + (|haddProp| |$ConstructorCache| '|PrimitiveArray| (LIST |dv$1|) + (CONS 1 $)) + (|stuffDomainSlots| $) + (|setShellEntry| $ 6 |#1|) + $)))) + +(MAKEPROP '|PrimitiveArray| '|infovec| + (LIST '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) + (|NonNegativeInteger|) |PRIMARR;#;$Nni;1| (|Integer|) + |PRIMARR;minIndex;$I;2| |PRIMARR;empty;$;3| + |PRIMARR;fill!;$S$;9| |PRIMARR;new;NniS$;4| + |PRIMARR;qelt;$IS;5| |PRIMARR;elt;$IS;6| + |PRIMARR;qsetelt!;$I2S;7| |PRIMARR;setelt;$I2S;8| + (|Mapping| 6 6 6) (|Boolean|) (|List| 6) (|Equation| 6) + (|List| 21) (|Mapping| 19 6) (|Mapping| 19 6 6) + (|UniversalSegment| 9) (|Void|) (|Mapping| 6 6) + (|OutputForm|) (|InputForm|) (|String|) (|SingleInteger|) + (|List| $) (|Union| 6 '"failed") (|List| 9)) + '#(~= 0 |swap!| 6 |sorted?| 13 |sort!| 24 |sort| 35 |size?| + 46 |setelt| 52 |select| 66 |sample| 72 |reverse!| 76 + |reverse| 81 |removeDuplicates| 86 |remove| 91 |reduce| + 103 |qsetelt!| 124 |qelt| 131 |position| 137 |parts| 156 + |new| 161 |more?| 167 |minIndex| 173 |min| 178 |merge| 184 + |members| 197 |member?| 202 |maxIndex| 208 |max| 213 + |map!| 219 |map| 225 |less?| 238 |latex| 244 |insert| 249 + |indices| 263 |index?| 268 |hash| 274 |first| 279 |find| + 284 |fill!| 290 |every?| 296 |eval| 302 |eq?| 328 |entry?| + 334 |entries| 340 |empty?| 345 |empty| 350 |elt| 354 + |delete| 373 |count| 385 |copyInto!| 397 |copy| 404 + |convert| 409 |construct| 414 |concat| 419 |coerce| 442 + |any?| 447 >= 453 > 459 = 465 <= 471 < 477 |#| 483) + '((|shallowlyMutable| . 0) (|finiteAggregate| . 0)) + (CONS (|makeByteWordVec2| 5 + '(0 0 0 0 0 0 5 0 0 1 4 0 0 1 2 3 4)) + (CONS '#(|OneDimensionalArrayAggregate&| + |FiniteLinearAggregate&| |LinearAggregate&| + |IndexedAggregate&| |Collection&| + |HomogeneousAggregate&| |OrderedSet&| + |Aggregate&| |EltableAggregate&| |Evalable&| + |SetCategory&| NIL NIL |InnerEvalable&| NIL + NIL |BasicType&|) + (CONS '#((|OneDimensionalArrayAggregate| 6) + (|FiniteLinearAggregate| 6) + (|LinearAggregate| 6) + (|IndexedAggregate| 9 6) + (|Collection| 6) + (|HomogeneousAggregate| 6) + (|OrderedSet|) (|Aggregate|) + (|EltableAggregate| 9 6) (|Evalable| 6) + (|SetCategory|) (|Type|) (|Eltable| 9 6) + (|InnerEvalable| 6 6) (|CoercibleTo| 28) + (|ConvertibleTo| 29) (|BasicType|)) + (|makeByteWordVec2| 34 + '(2 7 19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 8))))) + '|lookupComplete|)) @ + \section{package PRIMARR2 PrimitiveArrayFunctions2} + <<package PRIMARR2 PrimitiveArrayFunctions2>>= )abbrev package PRIMARR2 PrimitiveArrayFunctions2 ++ This package provides tools for operating on primitive arrays |