aboutsummaryrefslogtreecommitdiff
path: root/src/algebra
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2012-05-01 02:27:52 +0000
committerdos-reis <gdr@axiomatics.org>2012-05-01 02:27:52 +0000
commite37c877a8ad003972fc6c0206dc6220e266f0a8b (patch)
tree6a4dafe69f35f013172cdbf7b646064328380986 /src/algebra
parent52d8ccbf25a71457f923860824696742328bdb35 (diff)
downloadopen-axiom-e37c877a8ad003972fc6c0206dc6220e266f0a8b.tar.gz
* algebra/integer.spad.pamphlet (Integer): Use %iaddmod, %isubmod,
%imulmod. * algebra/si.spad.pamphlet (SingleInteger): Likewise. * interp/c-util.boot (devaluate): Use # in lieu of QVSIZE. * interp/g-opt.boot: %ilfshift and %irshift are now builtin side-effect free operations. * interp/lisp-backend.boot: Translate them. * interp/g-util.boot (mergeSort): Avoid QSDIFFERENCE. * interp/slam.boot: Likewise. * interp/sys-macros.lisp: Likewise. * interp/macros.lisp: Avoid QVMAXINDEX. * interp/vmlisp.lisp (QSDIFFERENCE): Remove. (QSGREATERP): Likewise. (QSLEFTSHIFT): Likewise. (QSLESSP): Likewise. (QSMAX): Likewise. (QSMIN): Likewise. (QSMINUS): Likewise. (QSMINUSP): Likewise. (QSODDP): Likewise. (QSABSVAL): Likewise. (QSPLUS): Likewise. (QSZEROP): Likewise. (QVMAXINDEX): Likewise. (QVSIZE): Likewise. (ZERO?): Likewise.
Diffstat (limited to 'src/algebra')
-rw-r--r--src/algebra/integer.spad.pamphlet18
-rw-r--r--src/algebra/si.spad.pamphlet13
2 files changed, 13 insertions, 18 deletions
diff --git a/src/algebra/integer.spad.pamphlet b/src/algebra/integer.spad.pamphlet
index e7de9302..5806c706 100644
--- a/src/algebra/integer.spad.pamphlet
+++ b/src/algebra/integer.spad.pamphlet
@@ -89,10 +89,14 @@ Integer: IntegerNumberSystem with
import %ieven?: % -> Boolean from Foreign Builtin
import %hash: % -> SingleInteger from Foreign Builtin
import %iadd: (%,%) -> % from Foreign Builtin
+ import %iaddmod: (%,%,%) -> % from Foreign Builtin
import %isub: (%,%) -> % from Foreign Builtin
+ import %isubmod: (%,%,%) -> % from Foreign Builtin
import %imul: (%,%) -> % from Foreign Builtin
+ import %imulmod: (%,%,%) -> % from Foreign Builtin
import %irem: (%,%) -> % from Foreign Builtin
import %iquo: (%,%) -> % from Foreign Builtin
+ import %ilshift: (%,%) -> % from Foreign Builtin
import %imax: (%,%) -> % from Foreign Builtin
import %imin: (%,%) -> % from Foreign Builtin
import %igcd: (%,%) -> % from Foreign Builtin
@@ -123,15 +127,9 @@ Integer: IntegerNumberSystem with
coerce(m:Integer):% == m pretend %
convert(x:%):Integer == x pretend Integer
length a == %ilength a
- addmod(a, b, p) ==
- c := %iadd(a,b)
- c >= p => c - p
- c
- submod(a, b, p) ==
- c := %isub(a,b)
- negative? c => c + p
- c
- mulmod(a, b, p) == %imul(a,b) rem p
+ addmod(a, b, p) == %iaddmod(a,b,p)
+ submod(a, b, p) == %isubmod(a,b,p)
+ mulmod(a, b, p) == %imulmod(a,b,p)
convert(x:%):Float == coerce(x)$Float
convert(x:%):DoubleFloat == coerce(x)$DoubleFloat
convert(x:%):InputForm == convert(x)$InputForm
@@ -175,7 +173,7 @@ Integer: IntegerNumberSystem with
divide(x,y) == %idivide(x,y)$Foreign(Builtin)
x quo y == %iquo(x,y)
x rem y == %irem(x,y)
- shift(x, y) == ASH(x,y)$Lisp
+ shift(x, y) == %ilshift(x,y)
recip(x) == if one? x or x=-1 then x else "failed"
gcd(x,y) == %igcd(x,y)
UCA ==> Record(unit:%,canonical:%,associate:%)
diff --git a/src/algebra/si.spad.pamphlet b/src/algebra/si.spad.pamphlet
index d982c432..795a75ed 100644
--- a/src/algebra/si.spad.pamphlet
+++ b/src/algebra/si.spad.pamphlet
@@ -179,10 +179,6 @@ IntegerNumberSystem(): Category ==
-- MODULUS, MULTIPLIER (random number generator constants)
--- Lisp dependencies
--- QSLEFTSHIFT
-
-
SingleInteger(): Join(IntegerNumberSystem,OrderedFinite,BooleanLogic) with
canonical
++ \spad{canonical} means that mathematical equality is implied by data structure equality.
@@ -204,11 +200,12 @@ SingleInteger(): Join(IntegerNumberSystem,OrderedFinite,BooleanLogic) with
import %iadd: (%,%) -> % from Foreign Builtin
import %iaddmod: (%,%,%) -> % from Foreign Builtin
import %isub: (%,%) -> % from Foreign Builtin
- import %isubmod: (%,%) -> % from Foreign Builtin
+ import %isubmod: (%,%,%) -> % from Foreign Builtin
import %imul: (%,%) -> % from Foreign Builtin
import %imulmod: (%,%,%) -> % from Foreign Builtin
import %irem: (%,%) -> % from Foreign Builtin
import %iquo: (%,%) -> % from Foreign Builtin
+ import %ilshift: (%,%) -> % from Foreign Builtin
import %ineg: % -> % from Foreign Builtin
import %iinc: % -> % from Foreign Builtin
import %idec: % -> % from Foreign Builtin
@@ -273,10 +270,10 @@ SingleInteger(): Join(IntegerNumberSystem,OrderedFinite,BooleanLogic) with
min(x,y) == %imin(x,y)
hash(x) == %hash x
length(x) == %ilength x
- shift(x,n) == QSLEFTSHIFT(x,n)$Lisp
+ shift(x,n) == %ilshift(x,n)
mulmod(a,b,p) == %imulmod(a,b,p)
- addmod(a,b,p) == %iaddmod(a,b,p)$Lisp
- submod(a,b,p) == %isubmod(a,b,p)$Lisp
+ addmod(a,b,p) == %iaddmod(a,b,p)
+ submod(a,b,p) == %isubmod(a,b,p)
negative?(x) == %ilt(x,%icst0)
size() ==
(%icstmax - %icstmin + %icst1) pretend NonNegativeInteger