aboutsummaryrefslogtreecommitdiff
path: root/src/algebra
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-06-01 00:22:44 +0000
committerdos-reis <gdr@axiomatics.org>2010-06-01 00:22:44 +0000
commit5b0462a5f0b499c2c3177e36e52b476875141969 (patch)
treea698fd6d161395245e4b1bdc349724f503ec8c44 /src/algebra
parenta1eeda981dd4d753a805ff4a13a4ef26d167a7fb (diff)
downloadopen-axiom-5b0462a5f0b499c2c3177e36e52b476875141969.tar.gz
* interp/g-util.boot: Add more opcodes.
* algebra/syntax.spad.pamphlet: Clean up. * algebra/variable.spad.pamphlet: Likewise. * algebra/ystream.spad.pamphlet: Likewise.
Diffstat (limited to 'src/algebra')
-rw-r--r--src/algebra/syntax.spad.pamphlet28
-rw-r--r--src/algebra/variable.spad.pamphlet6
-rw-r--r--src/algebra/ystream.spad.pamphlet14
3 files changed, 30 insertions, 18 deletions
diff --git a/src/algebra/syntax.spad.pamphlet b/src/algebra/syntax.spad.pamphlet
index ef4501ff..1579e187 100644
--- a/src/algebra/syntax.spad.pamphlet
+++ b/src/algebra/syntax.spad.pamphlet
@@ -114,17 +114,21 @@ 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
+
x = y ==
EQUAL(x,y)$Lisp
s case Integer ==
- INTEGERP(s)$Lisp
+ %integer? s
s case DoubleFloat ==
- FLOATP(s)$Lisp
+ %float? s
s case String ==
- STRINGP(s)$Lisp
+ %string? s
s case Identifier ==
IDENTP(s)$Lisp
@@ -198,10 +202,10 @@ Syntax(): Public == Private where
--% syntax construction
buildSyntax(s: Identifier, l: List %): % ==
- CONS(s,l)$Lisp
+ %makepair(s,l)$Foreign(Builtin)
buildSyntax(op: %, l: List %): % ==
- CONS(op,l)$Lisp
+ %makepair(op,l)$Foreign(Builtin)
nil? x ==
NULL(x)$Lisp
@@ -267,7 +271,9 @@ ElaboratedExpression(): Public == Private where
++ getOperands(e) returns the list of operands in `e', assuming it
++ is a call form.
- Private ==> add
+ Private == add
+ import %eq: (%,%) -> Boolean from Foreign Builtin
+ import %pair?: % -> Boolean from Foreign Builtin
isAtomic(x: %): Boolean ==
ATOM(x)$Lisp
@@ -275,7 +281,7 @@ ElaboratedExpression(): Public == Private where
getMode(x)$Lisp
callForm? x ==
- CONSP(x)$Lisp
+ %pair? x
getOperator x ==
op: SExpression := getUnnameIfCan(x)$Lisp
@@ -284,7 +290,7 @@ ElaboratedExpression(): Public == Private where
constant? x ==
isAtomic x and
- EQ(getUnnameIfCan(x)$Lisp, _$immediateDataSymbol$Lisp)$Lisp : Boolean
+ %eq(getUnnameIfCan(x)$Lisp, _$immediateDataSymbol$Lisp)
getConstant x ==
constant? x => getValue(x)$Lisp @ SExpression
@@ -580,8 +586,10 @@ Identifier(): Public == Private where
++ \spad{gensym()} returns a new identifier, different from
++ any other identifier in the running system
Private == add
- gensym() == GENSYM()$Foreign(Builtin)
- x = y == EQ(x,y)$Lisp
+ import %eq: (%,%) -> Boolean from Foreign Builtin
+ import %gensym: () -> % from Foreign Builtin
+ gensym() == %gensym()
+ x = y == %eq(x,y)
coerce(x: %): Symbol == x : Symbol
coerce(x: %): OutputForm == x : OutputForm
diff --git a/src/algebra/variable.spad.pamphlet b/src/algebra/variable.spad.pamphlet
index edf83230..1ae7899d 100644
--- a/src/algebra/variable.spad.pamphlet
+++ b/src/algebra/variable.spad.pamphlet
@@ -101,16 +101,18 @@ AnonymousFunction():SetCategory with
++ body(f) returns the body of the unnamed function `f'.
== add
import Syntax
+ import %lsecond: % -> Syntax from Foreign Builtin
+ import %lthird: % -> Syntax from Foreign Builtin
coerce(x:%):OutputForm ==
x pretend OutputForm
parameters f ==
- ps := CADR(f)$Lisp : Syntax
+ ps := %lsecond f
ps case Identifier => [ps]$List(Identifier)
getOperands(ps) pretend List(Identifier)
body f ==
- CADDR(f)$Lisp : Syntax
+ %lthird f
@
diff --git a/src/algebra/ystream.spad.pamphlet b/src/algebra/ystream.spad.pamphlet
index 2f63b7bb..a085c647 100644
--- a/src/algebra/ystream.spad.pamphlet
+++ b/src/algebra/ystream.spad.pamphlet
@@ -38,20 +38,22 @@ ParadoxicalCombinatorsForStreams(A):Exports == Implementation where
++ a list of n streams and returns a list of n streams.
Implementation ==> add
+ import %head: ST A -> A from Foreign Builtin
+ import %tail: ST A -> ST A from Foreign Builtin
Y f ==
- y : ST A := CONS(0$I,0$I)$Lisp
+ y : ST A := %makepair(0$I,0$I)$Foreign(Builtin)
j := f y
- RPLACA(y,frst j)$Lisp
- RPLACD(y,rst j)$Lisp
+ %store(%head y,frst j)$Foreign(Builtin)
+ %store(%tail y,rst j)$Foreign(Builtin)
y
Y(g,n) ==
- x : L ST A := [CONS(0$I,0$I)$Lisp for i in 1..n]
+ x : L ST A := [%makepair(0$I,0$I)$Foreign(Builtin) for i in 1..n]
j := g x
for xi in x for ji in j repeat
- RPLACA(xi,frst ji)$Lisp
- RPLACD(xi,rst ji)$Lisp
+ %store(%head xi,frst ji)$Foreign(Builtin)
+ %store(%tail xi,rst ji)$Foreign(Builtin)
x
@