aboutsummaryrefslogtreecommitdiff
path: root/src/algebra
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-03-22 05:43:32 +0000
committerdos-reis <gdr@axiomatics.org>2011-03-22 05:43:32 +0000
commit41a15b30f26b7a2ca2077f7996a3cf552bf5630a (patch)
tree6a4ea472928d290faa82d6081df9286507eab6d0 /src/algebra
parent7dc19cbfb3fef1f70794d2baaebd183d21b7d6b0 (diff)
downloadopen-axiom-41a15b30f26b7a2ca2077f7996a3cf552bf5630a.tar.gz
* algebra/op.spad.pamphlet (BasicOperator) [display]: Now return a
Maybe (List O -> O) value. [input]: Now return a Maybe(List SEX -> SEX). * algebra/kl.spad.pamphlet (Kernel): Adjust. * algebra/pattern.spad.pamphlet (Pattern): Likewise.
Diffstat (limited to 'src/algebra')
-rw-r--r--src/algebra/kl.spad.pamphlet4
-rw-r--r--src/algebra/op.spad.pamphlet14
-rw-r--r--src/algebra/pattern.spad.pamphlet2
3 files changed, 9 insertions, 11 deletions
diff --git a/src/algebra/kl.spad.pamphlet b/src/algebra/kl.spad.pamphlet
index 18aa41f0..9840b033 100644
--- a/src/algebra/kl.spad.pamphlet
+++ b/src/algebra/kl.spad.pamphlet
@@ -204,7 +204,7 @@ Kernel(S: SetCategory): Exports == Implementation where
(f := property(o := operator k, SPECIALDISP)) case None =>
((f@None) pretend (List S -> OutputForm)) (argument k)
l := [x::OutputForm for x in argument k]$List(OutputForm)
- (u := display o) case "failed" => prefix(name(o)::OutputForm, l)
+ (u := display o) case nothing => prefix(name(o)::OutputForm, l)
(u::(List OutputForm -> OutputForm)) l
triage(k1, k2) ==
@@ -223,7 +223,7 @@ Kernel(S: SetCategory): Exports == Implementation where
(f := property(o := operator k, SPECIALINPUT)) case None =>
((f@None) pretend (List S -> InputForm)) (argument k)
l := [convert x for x in argument k]$List(InputForm)
- (u := input operator k) case "failed" =>
+ (u := input operator k) case nothing =>
convert concat(convert name operator k, l)
(u::(List InputForm -> InputForm)) l
diff --git a/src/algebra/op.spad.pamphlet b/src/algebra/op.spad.pamphlet
index cb2b1731..61bb3de6 100644
--- a/src/algebra/op.spad.pamphlet
+++ b/src/algebra/op.spad.pamphlet
@@ -59,9 +59,9 @@ BasicOperator(): Exports == Implementation where
++ to op. If op1 and op2 have the same name, and one of them
++ has a "%less?" property f, then \spad{f(op1, op2)} is called to
++ decide whether \spad{op1 < op2}.
- display : $ -> Union(List O -> O, "failed")
+ display : $ -> Maybe(List O -> O)
++ display(op) returns the "%display" property of op if
- ++ it has one attached, and "failed" otherwise.
+ ++ it has one attached, and \spad{nothing} otherwise.
display : ($, List O -> O) -> $
++ display(op, foo) attaches foo as the "%display" property
++ of op. If op has a "%display" property f, then \spad{op(a1,...,an)}
@@ -75,9 +75,9 @@ BasicOperator(): Exports == Implementation where
++ input(op, foo) attaches foo as the "%input" property
++ of op. If op has a "%input" property f, then \spad{op(a1,...,an)}
++ gets converted to InputForm as \spad{f(a1,...,an)}.
- input : $ -> Union(List SEX -> SEX, "failed")
+ input : $ -> Maybe(List SEX -> SEX)
++ input(op) returns the "%input" property of op if
- ++ it has one attached, "failed" otherwise.
+ ++ it has one attached, \spad{nothing} otherwise.
has? : (%, Identifier) -> Boolean
++ \spad{has?(op,p)} tests if property \spad{s} is attached to \spad{op}.
assert : (%, Identifier) -> $
@@ -157,12 +157,10 @@ BasicOperator(): Exports == Implementation where
display(op:$, f:List O -> O) == setProperty(op, DISPLAY, f pretend None)
display op ==
- (u := property(op, DISPLAY)) case nothing => "failed"
- (u@None) pretend (List O -> O)
+ property(op, DISPLAY) pretend Maybe(List O -> O)
input op ==
- (u := property(op, SEXPR)) case nothing => "failed"
- (u@None) pretend (List SEX -> SEX)
+ property(op, SEXPR) pretend Maybe(List SEX -> SEX)
arity op == rep(op).narg
diff --git a/src/algebra/pattern.spad.pamphlet b/src/algebra/pattern.spad.pamphlet
index c5a667e6..f3368758 100644
--- a/src/algebra/pattern.spad.pamphlet
+++ b/src/algebra/pattern.spad.pamphlet
@@ -343,7 +343,7 @@ Pattern(R:SetCategory): Exports == Implementation where
p.ker.tag = PAT_ZERO => 0::Integer::O
p.ker.tag = PAT_ONE => 1::Integer::O
l := [x::O for x in p.ker.arg]$List(O)
- (u:=display(p.ker.op)) case "failed" =>prefix(name(p.ker.op)::O,l)
+ (u:=display(p.ker.op)) case nothing =>prefix(name(p.ker.op)::O,l)
(u::(List O -> O)) l
patcopy p ==