From ad7cf3f5d7ae1735c80fb98616cd870b64c80fdd Mon Sep 17 00:00:00 2001 From: dos-reis Date: Mon, 31 Jan 2011 23:30:54 +0000 Subject: * interp/g-opt.boot (optQSMINUS): Remove. * algebra/data.spad.pamphlet: Tidy. * algebra/plot.spad.pamphlet: Likewise. * algebra/plot3d.spad.pamphlet: Likewise. * algebra/si.spad.pamphlet: Likewise. * algebra/syntax.spad.pamphlet: Likewise. * algebra/list.spad.pamphlet: Remove use of NULL$Lisp. --- src/algebra/data.spad.pamphlet | 3 ++- src/algebra/list.spad.pamphlet | 35 +++++++++++++++++------------------ src/algebra/plot.spad.pamphlet | 2 +- src/algebra/plot3d.spad.pamphlet | 4 ++-- src/algebra/si.spad.pamphlet | 6 +++--- src/algebra/strap/SINT.lsp | 14 +++++++------- src/algebra/syntax.spad.pamphlet | 4 +++- 7 files changed, 35 insertions(+), 33 deletions(-) (limited to 'src/algebra') diff --git a/src/algebra/data.spad.pamphlet b/src/algebra/data.spad.pamphlet index 744db27c..102cd55e 100644 --- a/src/algebra/data.spad.pamphlet +++ b/src/algebra/data.spad.pamphlet @@ -269,7 +269,8 @@ UInt64() == SystemNonNegativeInteger 64 ++ This domain is a datatype system-level pointer values. SystemPointer(): SetCategory == add - x = y == EQL(x,y)$Foreign(Builtin) + import %sptreq: (%,%) -> Boolean from Foreign Builtin + x = y == %sptreq(x,y) coerce(x:%): OutputForm == FORMAT(NIL$Foreign(Builtin),"~A",x)$Foreign(Builtin) @ diff --git a/src/algebra/list.spad.pamphlet b/src/algebra/list.spad.pamphlet index aec6167f..3e7c6b28 100644 --- a/src/algebra/list.spad.pamphlet +++ b/src/algebra/list.spad.pamphlet @@ -44,12 +44,11 @@ IndexedList(S:Type, mn:Integer): Exports == Implementation where -- a knowledgeable person wants to update it: -- The following LISP dependencies are divided into two groups -- Those that are required --- CONS, EQ, NIL, NULL, RPLACA, RPLACD +-- CONS, EQ, NIL, RPLACA, RPLACD -- Those that are included for efficiency only -- LIST, NCONC2, LENGTH -- Also REVERSE, since it's called in Polynomial Ring - Qnull ==> NULL$Lisp Qpush ==> PUSH$Lisp Exports ==> ListAggregate S @@ -94,13 +93,13 @@ IndexedList(S:Type, mn:Integer): Exports == Implementation where rest(x, n) == for i in 1..n repeat - if Qnull x then error "index out of range" + if empty? x then error "index out of range" x := %tail x x copy x == y := empty() - for i in 0.. while not Qnull x repeat + for i in 0.. while not empty? x repeat if i = cycleMax and cyclic? x then error "cyclic list" y := %makepair(%head x,y) x := %tail x @@ -126,35 +125,35 @@ IndexedList(S:Type, mn:Integer): Exports == Implementation where if S has SetCategory then x = y == %peq(x,y) => true - while not Qnull x and not Qnull y repeat + while not empty? x and not empty? y repeat %head x ~=$S %head y => return false x := %tail x y := %tail y - Qnull x and Qnull y + empty? x and empty? y latex(x : %): String == s : String := "\left[" - while not Qnull x repeat + while not empty? x repeat s := concat(s, latex(%head x)$S)$String x := %tail x - if not Qnull x then s := concat(s, ", ")$String + if not empty? x then s := concat(s, ", ")$String concat(s, " \right]")$String member?(s,x) == - while not Qnull x repeat + while not empty? x repeat if s = %head x then return true else x := %tail x false -- Lots of code from parts of AGGCAT, repeated here to -- get faster compilation concat!(x:%,y:%) == - Qnull x => - Qnull y => x + empty? x => + empty? y => x Qpush(first y,x) QRPLACD(x,rest y)$Lisp x z:=x - while not Qnull %tail z repeat + while not empty? %tail z repeat z:=%tail z QRPLACD(z,y)$Lisp x @@ -163,13 +162,13 @@ IndexedList(S:Type, mn:Integer): Exports == Implementation where if S has SetCategory then removeDuplicates! l == p := l - while not Qnull p repeat + while not empty? p repeat -- p := setrest!(p, remove!(#1 = %head p, %tail p)) -- far too expensive - builds closures etc. pp:=p f:S:=%head p p:=%tail p - while not Qnull (pr:=%tail pp) repeat + while not empty? (pr:=%tail pp) repeat if (%head pr)@S = f then QRPLACD(pp,%tail pr)$Lisp else pp:=pr l @@ -180,17 +179,17 @@ IndexedList(S:Type, mn:Integer): Exports == Implementation where sort!(f, l) == mergeSort(f, l, #l) merge!(f, p, q) == - Qnull p => q - Qnull q => p + empty? p => q + empty? q => p %peq(p, q) => error "cannot merge a list into itself" if f(%head p, %head q) then (r := t := p; p := %tail p) else (r := t := q; q := %tail q) - while not Qnull p and not Qnull q repeat + while not empty? p and not empty? q repeat if f(%head p, %head q) then (QRPLACD(t, p)$Lisp; t := p; p := %tail p) else (QRPLACD(t, q)$Lisp; t := q; q := %tail q) - QRPLACD(t, if Qnull p then q else p)$Lisp + QRPLACD(t, if empty? p then q else p)$Lisp r split!(p, n) == diff --git a/src/algebra/plot.spad.pamphlet b/src/algebra/plot.spad.pamphlet index 8f4731b2..fdeeafed 100644 --- a/src/algebra/plot.spad.pamphlet +++ b/src/algebra/plot.spad.pamphlet @@ -284,7 +284,7 @@ Plot(): Exports == Implementation where xDiff = 0 or yDiff = 0 => curve l := lo tRange; h := hi tRange (tDiff := h-l) = 0 => curve --- if (EQL(yDiff, quietDoubleNaN()$Lisp)$Lisp) then yDiff := 1::F +-- if (%sptreq(yDiff, quietDoubleNaN()$Lisp)$Foreign(Builtin)) then yDiff := 1::F t := curve.knots #t < 3 => curve p := curve.points; f := curve.source diff --git a/src/algebra/plot3d.spad.pamphlet b/src/algebra/plot3d.spad.pamphlet index eae26c33..44429031 100644 --- a/src/algebra/plot3d.spad.pamphlet +++ b/src/algebra/plot3d.spad.pamphlet @@ -192,11 +192,11 @@ Plot3D(): Exports == Implementation where select(l,f,g) == m := f first l - if (EQL(m, quietDoubleNaN()$Lisp)$Lisp) then m := 0 + if (%sptreq(m, quietDoubleNaN()$Lisp)$Foreign(Builtin)) then m := 0 -- for p in rest l repeat m := g(m,fp) for p in rest l repeat fp : F := f p - if (EQL(fp, quietDoubleNaN()$Lisp)$Lisp) then fp := 0 + if (%sptreq(fp, quietDoubleNaN()$Lisp)$Foreign(Builtin)) then fp := 0 m := g(m,fp) m diff --git a/src/algebra/si.spad.pamphlet b/src/algebra/si.spad.pamphlet index c8226492..494f306c 100644 --- a/src/algebra/si.spad.pamphlet +++ b/src/algebra/si.spad.pamphlet @@ -182,8 +182,8 @@ IntegerNumberSystem(): Category == -- Lisp dependencies -- ABSVAL, TIMES, --- QSLESSP, QSGREATERP, QSMINUS, QSPLUS, QSDIFFERENCE --- QSTIMES,, QSODDP, QSNOT, QSAND +-- QSLESSP, QSGREATERP, QSDIFFERENCE +-- QSNOT, QSAND -- QSOR, QSXOR, QSLEFTSHIFT, QSADDMOD, QSDIFMOD, QSMULTMOD @@ -333,7 +333,7 @@ SingleInteger(): Join(IntegerNumberSystem,OrderedFinite,BooleanLogic,Logic,OpenM mulmod(a,b,p) == QSMULTMOD(a,b,p)$Lisp addmod(a,b,p) == QSADDMOD(a,b,p)$Lisp submod(a,b,p) == QSDIFMOD(a,b,p)$Lisp - negative?(x) == QSMINUSP$Lisp x + negative?(x) == %ilt(x,%icst0) size() == (MAXINT -$Lisp MININT +$Lisp %icst1) pretend NonNegativeInteger index i == per(i + MININT - 1$Lisp) lookup x == diff --git a/src/algebra/strap/SINT.lsp b/src/algebra/strap/SINT.lsp index 634d0e12..1aa715eb 100644 --- a/src/algebra/strap/SINT.lsp +++ b/src/algebra/strap/SINT.lsp @@ -247,7 +247,8 @@ (DECLAIM (FTYPE (FUNCTION (|%Short| |%Shell|) |%Boolean|) |SINT;negative?;$B;53|)) -(PUT '|SINT;negative?;$B;53| '|SPADreplace| 'QSMINUSP) +(PUT '|SINT;negative?;$B;53| '|SPADreplace| + '(XLAM (|x|) (|%ilt| |x| 0))) (DECLAIM (FTYPE (FUNCTION (|%Shell|) (|%IntegerSection| 0)) |SINT;size;Nni;54|)) @@ -291,7 +292,7 @@ (DEFUN |SINT;writeOMSingleInt| (|dev| |x| $) (SEQ (COND - ((QSMINUSP |x|) + ((MINUSP |x|) (SEQ (SPADCALL |dev| (|getShellEntry| $ 11)) (SPADCALL |dev| "arith1" "unaryminus" (|getShellEntry| $ 13)) @@ -469,7 +470,7 @@ (DEFUN |SINT;negative?;$B;53| (|x| $) (DECLARE (IGNORE $)) - (QSMINUSP |x|)) + (MINUSP |x|)) (DEFUN |SINT;size;Nni;54| ($) (DECLARE (IGNORE $)) @@ -490,8 +491,7 @@ (DEFUN |SINT;positiveRemainder;3$;58| (|x| |n| $) (LET ((|r| (REM |x| |n|))) (COND - ((QSMINUSP |r|) - (COND ((QSMINUSP |n|) (- |x| |n|)) (T (+ |r| |n|)))) + ((MINUSP |r|) (COND ((MINUSP |n|) (- |x| |n|)) (T (+ |r| |n|)))) (T |r|)))) (DEFUN |SINT;coerce;I$;59| (|x| $) @@ -505,11 +505,11 @@ (DEFUN |SINT;random;2$;61| (|n| $) (DECLARE (IGNORE $)) (RANDOM |n|)) (DEFUN |SINT;unitNormal;$R;62| (|x| $) - (COND ((QSMINUSP |x|) (VECTOR -1 (- |x|) -1)) (T (VECTOR 1 |x| 1)))) + (COND ((MINUSP |x|) (VECTOR -1 (- |x|) -1)) (T (VECTOR 1 |x| 1)))) (DEFUN |SingleInteger| () (DECLARE (SPECIAL |$ConstructorCache|)) - (PROG (#0=#:G1474) + (PROG (#0=#:G1478) (RETURN (COND ((SETQ #0# (HGET |$ConstructorCache| '|SingleInteger|)) diff --git a/src/algebra/syntax.spad.pamphlet b/src/algebra/syntax.spad.pamphlet index e676f343..c62ff29a 100644 --- a/src/algebra/syntax.spad.pamphlet +++ b/src/algebra/syntax.spad.pamphlet @@ -114,6 +114,8 @@ Syntax(): Public == Private where ++ x case String is true if `x' really is a String Private == add + import %nil: % from Foreign Builtin + import %peq: (%,%) -> Boolean from Foreign Builtin import %integer?: % -> Boolean from Foreign Builtin import %float?: % -> Boolean from Foreign Builtin import %string?: % -> Boolean from Foreign Builtin @@ -209,7 +211,7 @@ Syntax(): Public == Private where %makepair(op,l)$Foreign(Builtin) nil? x == - NULL(x)$Lisp + %peq(x,%nil) atom?(x: %): Boolean == ATOM(x)$Lisp -- cgit v1.2.3