aboutsummaryrefslogtreecommitdiff
path: root/src/algebra
diff options
context:
space:
mode:
Diffstat (limited to 'src/algebra')
-rw-r--r--src/algebra/any.spad.pamphlet2
-rw-r--r--src/algebra/catdef.spad.pamphlet4
-rw-r--r--src/algebra/data.spad.pamphlet4
-rw-r--r--src/algebra/domain.spad.pamphlet23
-rw-r--r--src/algebra/float.spad.pamphlet2
-rw-r--r--src/algebra/fname.spad.pamphlet6
-rw-r--r--src/algebra/integer.spad.pamphlet3
-rw-r--r--src/algebra/list.spad.pamphlet4
-rw-r--r--src/algebra/outform.spad.pamphlet3
-rw-r--r--src/algebra/random.spad.pamphlet9
-rw-r--r--src/algebra/sex.spad.pamphlet19
-rw-r--r--src/algebra/si.spad.pamphlet11
-rw-r--r--src/algebra/strap/INT.lsp2
-rw-r--r--src/algebra/strap/OUTFORM.lsp2
-rw-r--r--src/algebra/strap/SINT.lsp10
-rw-r--r--src/algebra/strap/SYMBOL.lsp2
-rw-r--r--src/algebra/symbol.spad.pamphlet4
-rw-r--r--src/algebra/syntax.spad.pamphlet17
18 files changed, 77 insertions, 50 deletions
diff --git a/src/algebra/any.spad.pamphlet b/src/algebra/any.spad.pamphlet
index 60aa47e9..6862e19f 100644
--- a/src/algebra/any.spad.pamphlet
+++ b/src/algebra/any.spad.pamphlet
@@ -377,7 +377,7 @@ Contour(): Public == Private where
nothing
push(b,c) ==
- CONS(b,c)$Lisp pretend %
+ %makepair(b,c)$Foreign(Builtin)
coerce c ==
(bindings c)::OutputForm
diff --git a/src/algebra/catdef.spad.pamphlet b/src/algebra/catdef.spad.pamphlet
index 1c22c456..f16ebd14 100644
--- a/src/algebra/catdef.spad.pamphlet
+++ b/src/algebra/catdef.spad.pamphlet
@@ -1917,7 +1917,9 @@ SetCategory(): Category == Join(BasicType,CoercibleTo OutputForm) with
latex: % -> String ++ latex(s) returns a LaTeX-printable output
++ representation of s.
add
- hash(s : %): SingleInteger == SXHASH(s)$Lisp
+ import %hash: % -> SingleInteger from Foreign Builtin
+
+ hash(s : %): SingleInteger == %hash s
latex(s : %): String == "\mbox{\bf Unimplemented}"
@
diff --git a/src/algebra/data.spad.pamphlet b/src/algebra/data.spad.pamphlet
index 06a73cf8..744db27c 100644
--- a/src/algebra/data.spad.pamphlet
+++ b/src/algebra/data.spad.pamphlet
@@ -401,6 +401,8 @@ DataArray(N: PositiveInteger, T: SetCategory): Public == Private where
++ setelt(b,i,x) sets the ith entry of data buffer `b' to `x'.
++ Indexing is 0-based.
Private == add
+ import %equal: (%,%) -> Boolean from Foreign Builtin
+
new() ==
makeSimpleArray(getVMType(T)$Foreign(Builtin),N)$Foreign(Builtin)
@@ -411,7 +413,7 @@ DataArray(N: PositiveInteger, T: SetCategory): Public == Private where
setSimpleArrayEntry(b,i,x)$Foreign(Builtin)
x = y ==
- EQUAL(x,y)$Foreign(Builtin)
+ %equal(x,y)
coerce(b: %): OutputForm ==
bracket([qelt(b,i)::OutputForm for i in 0..(N-1)])
diff --git a/src/algebra/domain.spad.pamphlet b/src/algebra/domain.spad.pamphlet
index ee52d8a5..0351c3f3 100644
--- a/src/algebra/domain.spad.pamphlet
+++ b/src/algebra/domain.spad.pamphlet
@@ -52,8 +52,10 @@ FunctionDescriptor(): Public == Private where
++ \spad{signature(x)} returns the signature of function
++ described by \spad{x}.
Private == add
+ import %equal: (%,%) -> Boolean from Foreign Builtin
+
signature x == %head(x)$Foreign(Builtin)
- x = y == EQUAL(x,y)$Lisp
+ x = y == %equal(x,y)
coerce x == (x : Syntax)::OutputForm
@
@@ -165,8 +167,9 @@ ConstructorCall(C: ConstructorCategory): Public == Private where
++ arguments used to invoke the constructor.
Private == add
- import %head: % -> C from Foreign Builtin
- import %tail: % -> List Syntax from Foreign Builtin
+ import %head: % -> C from Foreign Builtin
+ import %tail: % -> List Syntax from Foreign Builtin
+ import %equal: (%,%) -> Boolean from Foreign Builtin
constructor x ==
%head x
@@ -175,7 +178,7 @@ ConstructorCall(C: ConstructorCategory): Public == Private where
%tail x
x = y ==
- EQUAL(x,y)$Lisp
+ %equal(x,y)
coerce(x: %): OutputForm ==
outputDomainConstructor(x)$Foreign(Builtin)
@@ -247,6 +250,8 @@ FunctorData(): Public == Private where
++ \spad{lookupFunction x} returns the name of the lookup
++ function associated with the functor data \spad{x}.
Private == add
+ import %equal: (%,%) -> Boolean from Foreign Builtin
+
domainTemplate x == %head(x)$Foreign(Builtin)
attributeData x == CADDR(x)$Foreign(Builtin)
@@ -256,7 +261,7 @@ FunctorData(): Public == Private where
encodingDirectory x == CDDDR(part3Data x)$Foreign(Builtin)
lookupFunction x == CADDDDR(x)$Foreign(Builtin)
- x = y == EQUAL(x,y)$Foreign(Builtin)
+ x = y == %equal(x,y)
coerce(x: %): OutputForm ==
import SExpression
(x pretend SExpression)::OutputForm
@@ -336,10 +341,12 @@ OperatorSignature(): Public == Private where
++ construct(op,sig) construct a signature-operator with
++ operator name `op', and signature `sig'.
Private == add
+ import %equal: (%,%) -> Boolean from Foreign Builtin
+
construct(o,s) == LIST(o,s)$Lisp
name x == %head(x)$Foreign(Builtin)
signature x == CADR(x)$Lisp
- x = y == EQUAL(x,y)$Lisp
+ x = y == %equal(x,y)
arity x == (#source signature x)::Arity
coerce(x: %): OutputForm ==
infix('_:::OutputForm, name(x)::OutputForm,
@@ -354,7 +361,9 @@ OperatorSignature(): Public == Private where
SystemPredicate(): Public == Private where
Public == SetCategory
Private == add
- x = y == EQUAL(x,y)$Lisp
+ import %equal: (%,%) -> Boolean from Foreign Builtin
+
+ x = y == %equal(x,y)
coerce(x: %): OutputForm ==
%not(x)$Foreign(Builtin) => 'false::OutputForm
%peq(x,'T)$Foreign(Builtin) => 'true::OutputForm
diff --git a/src/algebra/float.spad.pamphlet b/src/algebra/float.spad.pamphlet
index d8f7aa80..ce8ad925 100644
--- a/src/algebra/float.spad.pamphlet
+++ b/src/algebra/float.spad.pamphlet
@@ -179,7 +179,7 @@ Float():
== add
BASE ==> 2
BITS:Reference(PI) := ref 68 -- 20 digits
- LENGTH ==> INTEGER_-LENGTH$Lisp
+ LENGTH ==> %ilength$Foreign(Builtin)
ISQRT ==> approxSqrt$IntegerRoots(I)
Rep := Record( mantissa:I, exponent:I )
StoredConstant ==> Record( precision:PI, value:% )
diff --git a/src/algebra/fname.spad.pamphlet b/src/algebra/fname.spad.pamphlet
index 174a2eab..7b01e135 100644
--- a/src/algebra/fname.spad.pamphlet
+++ b/src/algebra/fname.spad.pamphlet
@@ -77,8 +77,10 @@ FileNameCategory(): Category == Join(SetCategory, HomotopicTo String) with
++ This domain provides an interface to names in the file system.
FileName(): FileNameCategory == add
-
- f1 = f2 == EQUAL(f1, f2)$Lisp
+
+ import %equal: (%,%) -> Boolean from Foreign Builtin
+
+ f1 = f2 == %equal(f1,f2)
coerce(f: %): OutputForm == f::String::OutputForm
coerce(f: %): String == NAMESTRING(f)$Lisp
diff --git a/src/algebra/integer.spad.pamphlet b/src/algebra/integer.spad.pamphlet
index fa8cdb76..3e3d71f9 100644
--- a/src/algebra/integer.spad.pamphlet
+++ b/src/algebra/integer.spad.pamphlet
@@ -101,6 +101,7 @@ Integer: Join(IntegerNumberSystem, ConvertibleTo String, OpenMath) with
import %ile: (%,%) -> Boolean from Foreign Builtin
import %igt: (%,%) -> Boolean from Foreign Builtin
import %ige: (%,%) -> Boolean from Foreign Builtin
+ import %ilength: % -> % from Foreign Builtin
x,y: %
n: NonNegativeInteger
@@ -161,7 +162,7 @@ Integer: Join(IntegerNumberSystem, ConvertibleTo String, OpenMath) with
coerce(x):OutputForm == outputForm(x pretend Integer)
coerce(m:Integer):% == m pretend %
convert(x:%):Integer == x pretend Integer
- length a == INTEGER_-LENGTH(a)$Lisp
+ length a == %ilength a
addmod(a, b, p) ==
c := %iadd(a,b)
c >= p => c - p
diff --git a/src/algebra/list.spad.pamphlet b/src/algebra/list.spad.pamphlet
index c67f91c1..aec6167f 100644
--- a/src/algebra/list.spad.pamphlet
+++ b/src/algebra/list.spad.pamphlet
@@ -44,9 +44,9 @@ 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, QCAR, QCDR, RPLACA, RPLACD
+-- CONS, EQ, NIL, NULL, RPLACA, RPLACD
-- Those that are included for efficiency only
--- LIST, CAR, CDR, NCONC2, NREVERSE, LENGTH
+-- LIST, NCONC2, LENGTH
-- Also REVERSE, since it's called in Polynomial Ring
Qnull ==> NULL$Lisp
diff --git a/src/algebra/outform.spad.pamphlet b/src/algebra/outform.spad.pamphlet
index 9880f30e..15f3c259 100644
--- a/src/algebra/outform.spad.pamphlet
+++ b/src/algebra/outform.spad.pamphlet
@@ -476,6 +476,7 @@ OutputForm(): SetCategory with
== add
import NumberFormats
+ import %equal: (%,%) -> Boolean from Foreign Builtin
-- Todo:
-- program forms, greek letters
@@ -510,7 +511,7 @@ OutputForm(): SetCategory with
print x == mathprint(x)$Lisp
message s == (empty? s => empty(); s pretend %)
messagePrint s == print message s
- (a:% = b:%): Boolean == EQUAL(a, b)$Lisp
+ (a:% = b:%): Boolean == %equal(a,b)
(a:% = b:%):% == bless [eform '=, a, b]
coerce(a):OutputForm == a pretend OutputForm
outputForm n == n pretend %
diff --git a/src/algebra/random.spad.pamphlet b/src/algebra/random.spad.pamphlet
index f28575cb..e4ba0bf5 100644
--- a/src/algebra/random.spad.pamphlet
+++ b/src/algebra/random.spad.pamphlet
@@ -150,9 +150,12 @@ IntegerBits: with
++ bitTruth(n,m) returns true if coefficient of 2**m in abs(n) is 1
== add
- bitLength n == INTEGER_-LENGTH(n)$Lisp
- bitCoef (n,i) == if INTEGER_-BIT(n,i)$Lisp then 1 else 0
- bitTruth(n,i) == INTEGER_-BIT(n,i)$Lisp
+ import %ilength: Integer -> Integer from Foreign Builtin
+ import %ibit: (Integer,Integer) -> Boolean from Foreign Builtin
+
+ bitLength n == %ilength n
+ bitCoef (n,i) == if %ibit(n,i) then 1 else 0
+ bitTruth(n,i) == %ibit(n,i)
@
\section{package RIDIST RandomIntegerDistributions}
diff --git a/src/algebra/sex.spad.pamphlet b/src/algebra/sex.spad.pamphlet
index 006bfcba..52b6d049 100644
--- a/src/algebra/sex.spad.pamphlet
+++ b/src/algebra/sex.spad.pamphlet
@@ -94,14 +94,15 @@ SExpressionOf(Str, Sym, Int, Flt, Expr): Decl == Body where
Decl ==> SExpressionCategory(Str, Sym, Int, Flt, Expr)
Body ==> add
- import %integer?: % -> Boolean from Foreign Builtin
- import %string?: % -> Boolean from Foreign Builtin
- import %pair?: % -> Boolean from Foreign Builtin
- import %peq: (%,%) -> Boolean from Foreign Builtin
- import %head: % -> % from Foreign Builtin
- import %tail: % -> % from Foreign Builtin
- import %llength: % -> Integer from Foreign Builtin
- import %nil: % from Foreign Builtin
+ import %integer?: % -> Boolean from Foreign Builtin
+ import %string?: % -> Boolean from Foreign Builtin
+ import %pair?: % -> Boolean from Foreign Builtin
+ import %peq: (%,%) -> Boolean from Foreign Builtin
+ import %head: % -> % from Foreign Builtin
+ import %tail: % -> % from Foreign Builtin
+ import %llength: % -> Integer from Foreign Builtin
+ import %nil: % from Foreign Builtin
+ import %equal: (%,%) -> Boolean from Foreign Builtin
Rep := Expr
@@ -120,7 +121,7 @@ SExpressionOf(Str, Sym, Int, Flt, Expr): Decl == Body where
#l = 2 and (first(l1) = QUOTE)@Boolean => quote first rest l1
paren blankSeparate l1
- b1 = b2 == EQUAL(b1,b2)$Lisp
+ b1 = b2 == %equal(b1,b2)
eq(b1, b2) == %peq(b1,b2)
null? b == %peq(b,%nil)
diff --git a/src/algebra/si.spad.pamphlet b/src/algebra/si.spad.pamphlet
index 9c248a18..c8226492 100644
--- a/src/algebra/si.spad.pamphlet
+++ b/src/algebra/si.spad.pamphlet
@@ -181,9 +181,9 @@ IntegerNumberSystem(): Category ==
-- Lisp dependencies
--- ABSVAL, TIMES, INTEGER-LENGTH,
+-- ABSVAL, TIMES,
-- QSLESSP, QSGREATERP, QSMINUS, QSPLUS, QSDIFFERENCE
--- QSTIMES,, QSODDP, QSZEROP, QSMAX, QSMIN, QSNOT, QSAND
+-- QSTIMES,, QSODDP, QSNOT, QSAND
-- QSOR, QSXOR, QSLEFTSHIFT, QSADDMOD, QSDIFMOD, QSMULTMOD
@@ -225,6 +225,7 @@ SingleInteger(): Join(IntegerNumberSystem,OrderedFinite,BooleanLogic,Logic,OpenM
import %imin: (%,%) -> % from Foreign Builtin
import %igcd: (%,%) -> % from Foreign Builtin
import %hash: % -> SingleInteger from Foreign Builtin
+ import %ilength: % -> % from Foreign Builtin
import %iodd?: % -> Boolean from Foreign Builtin
import %ieq: (%,%) -> Boolean from Foreign Builtin
import %ilt: (%,%) -> Boolean from Foreign Builtin
@@ -322,12 +323,12 @@ SingleInteger(): Join(IntegerNumberSystem,OrderedFinite,BooleanLogic,Logic,OpenM
gcd(x,y) == %igcd(x,y)
abs(x) == %iabs x
odd?(x) == %iodd? x
- zero?(x) == QSZEROP(x)$Lisp
- one?(x) == x = 1@%
+ zero?(x) == %ieq(x,%icst0)
+ one?(x) == %ieq(x,%icst1)
max(x,y) == %imax(x,y)
min(x,y) == %imin(x,y)
hash(x) == %hash x
- length(x) == INTEGER_-LENGTH(x)$Lisp
+ length(x) == %ilength x
shift(x,n) == QSLEFTSHIFT(x,n)$Lisp
mulmod(a,b,p) == QSMULTMOD(a,b,p)$Lisp
addmod(a,b,p) == QSADDMOD(a,b,p)$Lisp
diff --git a/src/algebra/strap/INT.lsp b/src/algebra/strap/INT.lsp
index 8ed6dc18..8e681337 100644
--- a/src/algebra/strap/INT.lsp
+++ b/src/algebra/strap/INT.lsp
@@ -70,7 +70,7 @@
(DECLAIM (FTYPE (FUNCTION (|%Integer| |%Shell|) |%Integer|)
|INT;length;2$;19|))
-(PUT '|INT;length;2$;19| '|SPADreplace| 'INTEGER-LENGTH)
+(PUT '|INT;length;2$;19| '|SPADreplace| '|%ilength|)
(DECLAIM (FTYPE (FUNCTION (|%Integer| |%Integer| |%Integer| |%Shell|)
|%Integer|)
diff --git a/src/algebra/strap/OUTFORM.lsp b/src/algebra/strap/OUTFORM.lsp
index 8916bd73..af6c2e66 100644
--- a/src/algebra/strap/OUTFORM.lsp
+++ b/src/algebra/strap/OUTFORM.lsp
@@ -37,7 +37,7 @@
(DECLAIM (FTYPE (FUNCTION (|%Thing| |%Thing| |%Shell|) |%Boolean|)
|OUTFORM;=;2$B;9|))
-(PUT '|OUTFORM;=;2$B;9| '|SPADreplace| 'EQUAL)
+(PUT '|OUTFORM;=;2$B;9| '|SPADreplace| '|%equal|)
(DECLAIM (FTYPE (FUNCTION (|%Thing| |%Thing| |%Shell|) |%Thing|)
|OUTFORM;=;3$;10|))
diff --git a/src/algebra/strap/SINT.lsp b/src/algebra/strap/SINT.lsp
index a3c55e19..634d0e12 100644
--- a/src/algebra/strap/SINT.lsp
+++ b/src/algebra/strap/SINT.lsp
@@ -194,11 +194,13 @@
(DECLAIM (FTYPE (FUNCTION (|%Short| |%Shell|) |%Boolean|)
|SINT;zero?;$B;43|))
-(PUT '|SINT;zero?;$B;43| '|SPADreplace| 'QSZEROP)
+(PUT '|SINT;zero?;$B;43| '|SPADreplace| '(XLAM (|x|) (|%ieq| |x| 0)))
(DECLAIM (FTYPE (FUNCTION (|%Short| |%Shell|) |%Boolean|)
|SINT;one?;$B;44|))
+(PUT '|SINT;one?;$B;44| '|SPADreplace| '(XLAM (|x|) (|%ieq| |x| 1)))
+
(DECLAIM (FTYPE (FUNCTION (|%Short| |%Short| |%Shell|) |%Short|)
|SINT;max;3$;45|))
@@ -217,7 +219,7 @@
(DECLAIM (FTYPE (FUNCTION (|%Short| |%Shell|) |%Short|)
|SINT;length;2$;48|))
-(PUT '|SINT;length;2$;48| '|SPADreplace| 'INTEGER-LENGTH)
+(PUT '|SINT;length;2$;48| '|SPADreplace| '|%ilength|)
(DECLAIM (FTYPE (FUNCTION (|%Short| |%Short| |%Shell|) |%Short|)
|SINT;shift;3$;49|))
@@ -287,8 +289,6 @@
(PUT '|SINT;or;3$;24| '|SPADreplace| 'LOGIOR)
-(PUT '|SINT;one?;$B;44| '|SPADreplace| '(XLAM (|x|) (|%ieq| |x| 1)))
-
(DEFUN |SINT;writeOMSingleInt| (|dev| |x| $)
(SEQ (COND
((QSMINUSP |x|)
@@ -433,7 +433,7 @@
(DEFUN |SINT;odd?;$B;42| (|x| $) (DECLARE (IGNORE $)) (ODDP |x|))
-(DEFUN |SINT;zero?;$B;43| (|x| $) (DECLARE (IGNORE $)) (QSZEROP |x|))
+(DEFUN |SINT;zero?;$B;43| (|x| $) (DECLARE (IGNORE $)) (ZEROP |x|))
(DEFUN |SINT;one?;$B;44| (|x| $) (DECLARE (IGNORE $)) (EQL |x| 1))
diff --git a/src/algebra/strap/SYMBOL.lsp b/src/algebra/strap/SYMBOL.lsp
index 72bde704..71fd3a5c 100644
--- a/src/algebra/strap/SYMBOL.lsp
+++ b/src/algebra/strap/SYMBOL.lsp
@@ -31,7 +31,7 @@
(DECLAIM (FTYPE (FUNCTION (|%Thing| |%Thing| |%Shell|) |%Boolean|)
|SYMBOL;=;2$B;9|))
-(PUT '|SYMBOL;=;2$B;9| '|SPADreplace| 'EQUAL)
+(PUT '|SYMBOL;=;2$B;9| '|SPADreplace| '|%equal|)
(DECLAIM (FTYPE (FUNCTION (|%Thing| |%Thing| |%Shell|) |%Boolean|)
|SYMBOL;<;2$B;10|))
diff --git a/src/algebra/symbol.spad.pamphlet b/src/algebra/symbol.spad.pamphlet
index 5268bca3..404465fe 100644
--- a/src/algebra/symbol.spad.pamphlet
+++ b/src/algebra/symbol.spad.pamphlet
@@ -70,6 +70,8 @@ Symbol(): Exports == Implementation where
++ sample() returns a sample of %
Implementation ==> add
+ import %equal: (%,%) -> Boolean from Foreign Builtin
+
count: Reference(Integer) := ref 0
xcount: AssociationList(%, Integer) := empty()
istrings:PrimitiveArray(String) :=
@@ -131,7 +133,7 @@ Symbol(): Exports == Implementation where
convert(s:%):InputForm == convert(s pretend Symbol)$InputForm
convert(s:%):Symbol == s pretend Symbol
coerce(s:String):% == VALUES(INTERN(s)$Lisp)$Lisp
- x = y == EQUAL(x,y)$Lisp
+ x = y == %equal(x,y)
x < y == GGREATERP(y, x)$Lisp
coerce(x:%):OutputForm == outputForm(x pretend Symbol)
subscript(sy, lx) == script(sy, [lx, nil, nil(), nil(), nil()])
diff --git a/src/algebra/syntax.spad.pamphlet b/src/algebra/syntax.spad.pamphlet
index 9856a21d..e676f343 100644
--- a/src/algebra/syntax.spad.pamphlet
+++ b/src/algebra/syntax.spad.pamphlet
@@ -114,12 +114,13 @@ Syntax(): Public == Private where
++ x case String is true if `x' really is a String
Private == add
- import %integer?: % -> Boolean from Foreign Builtin
- import %float?: % -> Boolean from Foreign Builtin
- import %string?: % -> Boolean from Foreign Builtin
+ import %integer?: % -> Boolean from Foreign Builtin
+ import %float?: % -> Boolean from Foreign Builtin
+ import %string?: % -> Boolean from Foreign Builtin
+ import %equal: (%,%) -> Boolean from Foreign Builtin
x = y ==
- EQUAL(x,y)$Lisp
+ %equal(x,y)
s case Integer ==
%integer? s
@@ -625,10 +626,12 @@ ParameterAst(): Public == Private where
++ object \spad{x} to \spadtype{String}. This function
++ is left at the discretion of the compiler.
Private == add
- import %string?: % -> Boolean from Foreign Builtin
+ import %string?: % -> Boolean from Foreign Builtin
+ import %equal: (%,%) -> Boolean from Foreign Builtin
+ import %ident?: % -> Boolean from Foreign Builtin
x case Identifier ==
- SYMBOLP(x)$Foreign(Builtin)
+ %ident? x
autoCoerce(x: %): Identifier ==
x : Identifier
@@ -640,7 +643,7 @@ ParameterAst(): Public == Private where
x : String
x = y ==
- EQUAL(x,y)$Foreign(Builtin)
+ %equal(x,y)
coerce(x: %): OutputForm ==
case x is