aboutsummaryrefslogtreecommitdiff
path: root/src/algebra
diff options
context:
space:
mode:
Diffstat (limited to 'src/algebra')
-rw-r--r--src/algebra/gaussian.spad.pamphlet38
-rw-r--r--src/algebra/pfr.spad.pamphlet8
-rw-r--r--src/algebra/sf.spad.pamphlet10
-rw-r--r--src/algebra/si.spad.pamphlet24
-rw-r--r--src/algebra/strap/SINT.lsp24
-rw-r--r--src/algebra/strap/SYMBOL.lsp3
-rw-r--r--src/algebra/symbol.spad.pamphlet5
7 files changed, 59 insertions, 53 deletions
diff --git a/src/algebra/gaussian.spad.pamphlet b/src/algebra/gaussian.spad.pamphlet
index 220947c9..dac3d85a 100644
--- a/src/algebra/gaussian.spad.pamphlet
+++ b/src/algebra/gaussian.spad.pamphlet
@@ -378,25 +378,25 @@ ComplexCategory(R:CommutativeRing): Category ==
pi() == pi()$R :: %
if R is DoubleFloat then
- stoc ==> S_-TO_-C$Lisp
- ctos ==> C_-TO_-S$Lisp
-
- exp x == ctos EXP(stoc x)$Lisp
- log x == ctos LOG(stoc x)$Lisp
-
- sin x == ctos SIN(stoc x)$Lisp
- cos x == ctos COS(stoc x)$Lisp
- tan x == ctos TAN(stoc x)$Lisp
- asin x == ctos ASIN(stoc x)$Lisp
- acos x == ctos ACOS(stoc x)$Lisp
- atan x == ctos ATAN(stoc x)$Lisp
-
- sinh x == ctos SINH(stoc x)$Lisp
- cosh x == ctos COSH(stoc x)$Lisp
- tanh x == ctos TANH(stoc x)$Lisp
- asinh x == ctos ASINH(stoc x)$Lisp
- acosh x == ctos ACOSH(stoc x)$Lisp
- atanh x == ctos ATANH(stoc x)$Lisp
+ stoc ==> %val2z$Foreign(Builtin)
+ ctos ==> %z2val$Foreign(Builtin)
+
+ exp x == ctos %zexp(stoc x)$Foreign(Builtin)
+ log x == ctos %zlog(stoc x)$Foreign(Builtin)
+
+ sin x == ctos %zsin(stoc x)$Foreign(Builtin)
+ cos x == ctos %zcos(stoc x)$Foreign(Builtin)
+ tan x == ctos %ztan(stoc x)$Foreign(Builtin)
+ asin x == ctos %zasin(stoc x)$Foreign(Builtin)
+ acos x == ctos %zacos(stoc x)$Foreign(Builtin)
+ atan x == ctos %zatan(stoc x)$Foreign(Builtin)
+
+ sinh x == ctos %zsinh(stoc x)$Foreign(Builtin)
+ cosh x == ctos %zcosh(stoc x)$Foreign(Builtin)
+ tanh x == ctos %ztanh(stoc x)$Foreign(Builtin)
+ asinh x == ctos %zasinh(stoc x)$Foreign(Builtin)
+ acosh x == ctos %zacosh(stoc x)$Foreign(Builtin)
+ atanh x == ctos %zatanh(stoc x)$Foreign(Builtin)
else
atan x ==
diff --git a/src/algebra/pfr.spad.pamphlet b/src/algebra/pfr.spad.pamphlet
index 4f0e97cb..6aec6821 100644
--- a/src/algebra/pfr.spad.pamphlet
+++ b/src/algebra/pfr.spad.pamphlet
@@ -114,10 +114,11 @@ PartialFraction(R: EuclideanDomain): Cat == Capsule where
Rep := Record(whole:R, fract: LfTerm)
+ import %before?: (FRR,FRR) -> Boolean from Foreign Builtin
+
-- private function signatures
copypf: % -> %
- LessThan: (fTerm, fTerm) -> Boolean
multiplyFracTerms: (fTerm, fTerm) -> %
normalizeFracTerm: fTerm -> %
partialFractionNormalized: (R, FRR) -> %
@@ -132,10 +133,9 @@ PartialFraction(R: EuclideanDomain): Cat == Capsule where
copypf(a: %): % == [a.whole,copy a.fract]$%
- LessThan(s: fTerm, t: fTerm) ==
+ LessThan(s: fTerm, t: fTerm): Boolean ==
-- have to wait until FR has < operation
- if (GGREATERP(s.den,t.den)$Lisp : Boolean) then false
- else true
+ %before?(s.den,t.den)
multiplyFracTerms(s : fTerm, t : fTerm) ==
nthFactor(s.den,1) = nthFactor(t.den,1) =>
diff --git a/src/algebra/sf.spad.pamphlet b/src/algebra/sf.spad.pamphlet
index 745dc254..b78d9bdb 100644
--- a/src/algebra/sf.spad.pamphlet
+++ b/src/algebra/sf.spad.pamphlet
@@ -475,10 +475,12 @@ DoubleFloat(): Join(FloatingPointSystem, DifferentialRing, OpenMath,
manexp(x) ==
zero? x => [0,0]
- s := sign x; x := abs x
- if x > max()$% then return [s*mantissa(max())+1,exponent max()]
- me:Record(man:%,exp:Integer) := MANEXP(x)$Lisp
- two53:= base()**precision()
+ s := sign x
+ x := abs x
+ if x > max()$% then
+ return [s*mantissa(max())+1,exponent max()]
+ me: Record(man:%,exp:Integer) := MANEXP(x)$Lisp
+ two53 := base()**precision()
[s*wholePart(two53 * me.man ),me.exp-precision()]
-- rationalApproximation(y,d,b) ==
diff --git a/src/algebra/si.spad.pamphlet b/src/algebra/si.spad.pamphlet
index dffa5e46..49fb6830 100644
--- a/src/algebra/si.spad.pamphlet
+++ b/src/algebra/si.spad.pamphlet
@@ -232,6 +232,10 @@ SingleInteger(): Join(IntegerNumberSystem,OrderedFinite,BooleanLogic,Logic,OpenM
import %ile: (%,%) -> Boolean from Foreign Builtin
import %igt: (%,%) -> Boolean from Foreign Builtin
import %ige: (%,%) -> Boolean from Foreign Builtin
+ import %bitnot: % -> % from Foreign Builtin
+ import %bitand: (%,%) -> % from Foreign Builtin
+ import %bitior: (%,%) -> % from Foreign Builtin
+ import %bitxor: (%,%) -> % from Foreign Builtin
seed : % := %icst1 -- for random()
MAXINT ==> _$ShortMaximum$Lisp
@@ -295,16 +299,16 @@ SingleInteger(): Join(IntegerNumberSystem,OrderedFinite,BooleanLogic,Logic,OpenM
max() == MAXINT
min() == MININT
x = y == %ieq(x,y)
- ~ x == LOGNOT(x)$Lisp
- not(x) == LOGNOT(x)$Lisp
- x /\ y == LOGAND(x,y)$Lisp
- x \/ y == LOGIOR(x,y)$Lisp
- Not(x) == LOGNOT(x)$Lisp
- And(x,y) == LOGAND(x,y)$Lisp
- x and y == And(x,y)
- Or(x,y) == LOGIOR(x,y)$Lisp
- x or y == Or(x,y)
- xor(x,y) == LOGXOR(x,y)$Lisp
+ ~ x == %bitnot x
+ not(x) == %bitnot x
+ x /\ y == %bitand(x,y)
+ x \/ y == %bitior(x,y)
+ Not(x) == %bitnot x
+ And(x,y) == %bitand(x,y)
+ x and y == %bitand(x,y)
+ Or(x,y) == %bitior(x,y)
+ x or y == %bitior(x,y)
+ xor(x,y) == %bitxor(x,y)
x < y == %ilt(x,y)
x > y == %igt(x,y)
x <= y == %ile(x,y)
diff --git a/src/algebra/strap/SINT.lsp b/src/algebra/strap/SINT.lsp
index 4632edb4..18b88fc4 100644
--- a/src/algebra/strap/SINT.lsp
+++ b/src/algebra/strap/SINT.lsp
@@ -62,48 +62,52 @@
(DECLAIM (FTYPE (FUNCTION (|%Short| |%Shell|) |%Short|) |SINT;~;2$;16|))
-(PUT '|SINT;~;2$;16| '|SPADreplace| 'LOGNOT)
+(PUT '|SINT;~;2$;16| '|SPADreplace| '|%bitnot|)
(DECLAIM (FTYPE (FUNCTION (|%Short| |%Shell|) |%Short|)
|SINT;not;2$;17|))
-(PUT '|SINT;not;2$;17| '|SPADreplace| 'LOGNOT)
+(PUT '|SINT;not;2$;17| '|SPADreplace| '|%bitnot|)
(DECLAIM (FTYPE (FUNCTION (|%Short| |%Short| |%Shell|) |%Short|)
|SINT;/\\;3$;18|))
-(PUT '|SINT;/\\;3$;18| '|SPADreplace| 'LOGAND)
+(PUT '|SINT;/\\;3$;18| '|SPADreplace| '|%bitand|)
(DECLAIM (FTYPE (FUNCTION (|%Short| |%Short| |%Shell|) |%Short|)
|SINT;\\/;3$;19|))
-(PUT '|SINT;\\/;3$;19| '|SPADreplace| 'LOGIOR)
+(PUT '|SINT;\\/;3$;19| '|SPADreplace| '|%bitior|)
(DECLAIM (FTYPE (FUNCTION (|%Short| |%Shell|) |%Short|)
|SINT;Not;2$;20|))
-(PUT '|SINT;Not;2$;20| '|SPADreplace| 'LOGNOT)
+(PUT '|SINT;Not;2$;20| '|SPADreplace| '|%bitnot|)
(DECLAIM (FTYPE (FUNCTION (|%Short| |%Short| |%Shell|) |%Short|)
|SINT;And;3$;21|))
-(PUT '|SINT;And;3$;21| '|SPADreplace| 'LOGAND)
+(PUT '|SINT;And;3$;21| '|SPADreplace| '|%bitand|)
(DECLAIM (FTYPE (FUNCTION (|%Short| |%Short| |%Shell|) |%Short|)
|SINT;and;3$;22|))
+(PUT '|SINT;and;3$;22| '|SPADreplace| '|%bitand|)
+
(DECLAIM (FTYPE (FUNCTION (|%Short| |%Short| |%Shell|) |%Short|)
|SINT;Or;3$;23|))
-(PUT '|SINT;Or;3$;23| '|SPADreplace| 'LOGIOR)
+(PUT '|SINT;Or;3$;23| '|SPADreplace| '|%bitior|)
(DECLAIM (FTYPE (FUNCTION (|%Short| |%Short| |%Shell|) |%Short|)
|SINT;or;3$;24|))
+(PUT '|SINT;or;3$;24| '|SPADreplace| '|%bitior|)
+
(DECLAIM (FTYPE (FUNCTION (|%Short| |%Short| |%Shell|) |%Short|)
|SINT;xor;3$;25|))
-(PUT '|SINT;xor;3$;25| '|SPADreplace| 'LOGXOR)
+(PUT '|SINT;xor;3$;25| '|SPADreplace| '|%bitxor|)
(DECLAIM (FTYPE (FUNCTION (|%Short| |%Short| |%Shell|) |%Boolean|)
|SINT;<;2$B;26|))
@@ -280,10 +284,6 @@
(DECLAIM (FTYPE (FUNCTION (|%Short| |%Shell|) |%Shell|)
|SINT;unitNormal;$R;62|))
-(PUT '|SINT;and;3$;22| '|SPADreplace| 'LOGAND)
-
-(PUT '|SINT;or;3$;24| '|SPADreplace| 'LOGIOR)
-
(PUT '|SINT;size;Nni;54| '|SPADreplace|
'(XLAM NIL (|%iadd| (|%isub| |$ShortMaximum| |$ShortMinimum|) 1)))
diff --git a/src/algebra/strap/SYMBOL.lsp b/src/algebra/strap/SYMBOL.lsp
index 320352ff..add07b55 100644
--- a/src/algebra/strap/SYMBOL.lsp
+++ b/src/algebra/strap/SYMBOL.lsp
@@ -36,8 +36,7 @@
(DECLAIM (FTYPE (FUNCTION (|%Thing| |%Thing| |%Shell|) |%Boolean|)
|SYMBOL;<;2$B;10|))
-(PUT '|SYMBOL;<;2$B;10| '|SPADreplace|
- '(XLAM (|x| |y|) (GGREATERP |y| |x|)))
+(PUT '|SYMBOL;<;2$B;10| '|SPADreplace| '|%before?|)
(DECLAIM (FTYPE (FUNCTION (|%Thing| |%Shell|) |%Thing|)
|SYMBOL;coerce;$Of;11|))
diff --git a/src/algebra/symbol.spad.pamphlet b/src/algebra/symbol.spad.pamphlet
index 404465fe..28deb174 100644
--- a/src/algebra/symbol.spad.pamphlet
+++ b/src/algebra/symbol.spad.pamphlet
@@ -70,7 +70,8 @@ Symbol(): Exports == Implementation where
++ sample() returns a sample of %
Implementation ==> add
- import %equal: (%,%) -> Boolean from Foreign Builtin
+ import %equal: (%,%) -> Boolean from Foreign Builtin
+ import %before?: (%,%) -> Boolean from Foreign Builtin
count: Reference(Integer) := ref 0
xcount: AssociationList(%, Integer) := empty()
@@ -134,7 +135,7 @@ Symbol(): Exports == Implementation where
convert(s:%):Symbol == s pretend Symbol
coerce(s:String):% == VALUES(INTERN(s)$Lisp)$Lisp
x = y == %equal(x,y)
- x < y == GGREATERP(y, x)$Lisp
+ x < y == %before?(x,y)
coerce(x:%):OutputForm == outputForm(x pretend Symbol)
subscript(sy, lx) == script(sy, [lx, nil, nil(), nil(), nil()])
elt(sy,lx) == subscript(sy,lx)