aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2008-10-19 03:17:48 +0000
committerdos-reis <gdr@axiomatics.org>2008-10-19 03:17:48 +0000
commitb0ca3ba70d1ef4a994d1f67a2086a7bfe6df2a7b (patch)
tree33ef4a4c6a61814b8eeff9d132673c2e1fc326a8
parentb1c72c39b960f8b0ad6471d331ff23f94bdfb6c1 (diff)
downloadopen-axiom-b0ca3ba70d1ef4a994d1f67a2086a7bfe6df2a7b.tar.gz
* algebra/syntax.spad.pamphlet (Syntax): Now belong to
RetractableTo Integer, RetractableTo DoubleFloat, RetractableTo Symbol, and RetractableTo String.
-rw-r--r--src/ChangeLog6
-rw-r--r--src/algebra/Makefile.in6
-rw-r--r--src/algebra/Makefile.pamphlet6
-rw-r--r--src/algebra/syntax.spad.pamphlet44
4 files changed, 37 insertions, 25 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 8cd268ff..f725401e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,11 @@
2008-10-18 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * algebra/syntax.spad.pamphlet (Syntax): Now belong to
+ RetractableTo Integer, RetractableTo DoubleFloat, RetractableTo
+ Symbol, and RetractableTo String.
+
+2008-10-18 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
* algebra/syntax.spad.pamphlet (Syntax): Simplify.
2008-10-17 Gabriel Dos Reis <gdr@cs.tamu.edu>
diff --git a/src/algebra/Makefile.in b/src/algebra/Makefile.in
index 46e59144..f3521c0a 100644
--- a/src/algebra/Makefile.in
+++ b/src/algebra/Makefile.in
@@ -374,7 +374,7 @@ axiom_algebra_layer_0_objects = \
axiom_algebra_layer_1 = \
AGG AGG- IEVALAB IEVALAB- FORTCAT ITUPLE \
PATAB PPCURVE PSCURVE REAL RESLATC RETRACT \
- RETRACT- SEGCAT BINDING SYNTAX BMODULE LOGIC \
+ RETRACT- SEGCAT BINDING BMODULE LOGIC \
LOGIC- EVALAB EVALAB- FEVALAB FEVALAB- BYTE \
OSGROUP MAYBE DATABUF PROPLOG
@@ -386,7 +386,7 @@ axiom_algebra_layer_1_objects = \
$(addsuffix .$(FASLEXT),$(axiom_algebra_layer_1)))
axiom_algebra_layer_2 = \
ELTAGG ELTAGG- FMC FMFUN FORTFN FVC \
- CTORCALL FVFUN INTRET IXAGG IXAGG- SEGXCAT \
+ SYNTAX FVFUN INTRET IXAGG IXAGG- SEGXCAT \
CONTOUR LIST3 MKFUNC OASGP KTVLOGIC
axiom_algebra_layer_2_nrlibs = \
@@ -397,7 +397,7 @@ axiom_algebra_layer_2_objects = \
$(addsuffix .$(FASLEXT),$(axiom_algebra_layer_2)))
axiom_algebra_layer_3 = \
GRDEF SCOPE MAPHACK1 MAPHACK2 MAPHACK3 MAPPKG1 \
- MAPPKG2 MAPPKG3 INTBIT MONAD MONAD-
+ MAPPKG2 MAPPKG3 INTBIT MONAD MONAD- CTORCALL
diff --git a/src/algebra/Makefile.pamphlet b/src/algebra/Makefile.pamphlet
index 63c8c402..609786e6 100644
--- a/src/algebra/Makefile.pamphlet
+++ b/src/algebra/Makefile.pamphlet
@@ -217,7 +217,7 @@ coerce.spad.pamphlet (TYPE KOERCE KONVERT RETRACT)
axiom_algebra_layer_1 = \
AGG AGG- IEVALAB IEVALAB- FORTCAT ITUPLE \
PATAB PPCURVE PSCURVE REAL RESLATC RETRACT \
- RETRACT- SEGCAT BINDING SYNTAX BMODULE LOGIC \
+ RETRACT- SEGCAT BINDING BMODULE LOGIC \
LOGIC- EVALAB EVALAB- FEVALAB FEVALAB- BYTE \
OSGROUP MAYBE DATABUF PROPLOG
@@ -236,7 +236,7 @@ axiom_algebra_layer_1_objects = \
<<layer2>>=
axiom_algebra_layer_2 = \
ELTAGG ELTAGG- FMC FMFUN FORTFN FVC \
- CTORCALL FVFUN INTRET IXAGG IXAGG- SEGXCAT \
+ SYNTAX FVFUN INTRET IXAGG IXAGG- SEGXCAT \
CONTOUR LIST3 MKFUNC OASGP KTVLOGIC
axiom_algebra_layer_2_nrlibs = \
@@ -258,7 +258,7 @@ grdef.spad.pamphlet (GRDEF)
<<layer3>>=
axiom_algebra_layer_3 = \
GRDEF SCOPE MAPHACK1 MAPHACK2 MAPHACK3 MAPPKG1 \
- MAPPKG2 MAPPKG3 INTBIT MONAD MONAD-
+ MAPPKG2 MAPPKG3 INTBIT MONAD MONAD- CTORCALL
diff --git a/src/algebra/syntax.spad.pamphlet b/src/algebra/syntax.spad.pamphlet
index 380748d8..be0fc84b 100644
--- a/src/algebra/syntax.spad.pamphlet
+++ b/src/algebra/syntax.spad.pamphlet
@@ -34,11 +34,13 @@ import SExpression
++ while InputForm may contain atoms like vectors and other Lisp
++ objects, the Syntax domain is supposed to contain only that
++ initial algebra build from the primitives listed above.
-++ Related Constructors: Boolean, Integer, Float, Symbol, String, SExpression.
+++ Related Constructors: Integer, DoubleFloat, Symbol, String, SExpression.
++ See Also: SExpression.
++ The equality supported by this domain is structural.
Syntax(): Public == Private where
- Public == Join(UnionType, SetCategory) with
+ Public == Join(UnionType, SetCategory, RetractableTo Integer,
+ RetractableTo DoubleFloat, RetractableTo Symbol,
+ RetractableTo String) with
convert: % -> SExpression
++ convert(s) returns the s-expression representation of a syntax.
@@ -47,8 +49,6 @@ Syntax(): Public == Private where
++ is not an atom, it is expected that it designates a proper list,
++ e.g. a sequence of cons cells ending with nil.
- coerce: Integer -> %
- ++ coerce(i) injects the integer value `i' into the Syntax domain.
coerce: % -> Integer
++ coerce(s) extracts and integer value from the syntax `s'
autoCoerce: % -> Integer
@@ -56,8 +56,6 @@ Syntax(): Public == Private where
++ the syntax `s'; no check performed. To be called only
++ at the discretion of the compiler.
- coerce: DoubleFloat -> %
- ++ coerce(f) injects the float value `f' into the Syntax domain
coerce: % -> DoubleFloat
++ coerce(s) extracts a float value from the syntax `s'.
autoCoerce: % -> DoubleFloat
@@ -65,8 +63,6 @@ Syntax(): Public == Private where
++ no check performed. To be called only at the discretion of
++ the compiler
- coerce: Symbol -> %
- ++ coerce(s) injects the symbol `s' into the Syntax domain.
coerce: % -> Symbol
++ coerce(s) extracts a symbol from the syntax `s'.
autoCoerce: % -> Symbol
@@ -74,8 +70,6 @@ Syntax(): Public == Private where
++ domain `s'; no check performed. To be called only at
++ at the discretion of the compiler.
- coerce: String -> %
- ++ coerce(s) injects the string value `s' into the syntax domain
coerce: % -> String
++ coerce(s) extracts a string value from the syntax `s'.
autoCoerce: % -> String
@@ -150,9 +144,12 @@ Syntax(): Public == Private where
autoCoerce(i: %): Integer == -- used for hard coercion
i : Integer
- coerce(i: %): Integer ==
- i case Integer => i
- userError "invalid conversion target type"
+ retractIfCan(x: %): Union(Integer,"failed") ==
+ x case Integer => x@Integer
+ "failed"
+
+ coerce(i: %): Integer ==
+ retract(i)@Integer
coerce(f: DoubleFloat): % ==
f pretend %
@@ -160,9 +157,12 @@ Syntax(): Public == Private where
autoCoerce(f: %): DoubleFloat == -- used for hard coercion
f : DoubleFloat
+ retractIfCan(x: %): Union(DoubleFloat,"failed") ==
+ x case DoubleFloat => x@DoubleFloat
+ "failed"
+
coerce(f: %): DoubleFloat ==
- f case DoubleFloat => f
- userError "invalid conversion target type"
+ retract(f)@DoubleFloat
coerce(s: Symbol): % ==
s pretend %
@@ -170,9 +170,12 @@ Syntax(): Public == Private where
autoCoerce(s: %): Symbol == -- used for hard coercion
s : Symbol
+ retractIfCan(x: %): Union(Symbol,"failed") ==
+ x case Symbol => x@Symbol
+ "failed"
+
coerce(s: %): Symbol ==
- s case Symbol => s
- userError "invalid conversion target type"
+ retract(s)@Symbol
coerce(s: String): % ==
s pretend %
@@ -180,9 +183,12 @@ Syntax(): Public == Private where
autoCoerce(s: %): String == -- used for hard coercion
s : String
+ retractIfCan(x: %): Union(String,"failed") ==
+ x case String => x@String
+ "failed"
+
coerce(s: %): String ==
- s case String => s
- userError "invalid conversion target type"
+ retract(s)@String
buildSyntax(s: Symbol, l: List %): % ==
CONS(s,l)$Lisp