SExpression atoms cause getOperator to fail
A system for computer algebra and symbolic mathematics
Brought to you by:
dos-reis
SExpression atoms cause getOperator to fail within the Syntax domain, however, there is no corresponding `atom?' function within Syntax. I'd suggest adding:
atom?: Syntax -> Boolean
It is not possible to check for this condition without forcing a conversion to SExpression.
Logged In: YES
user_id=1496011
Originator: NO
Syntax is trying hard not to be SExpression.
What really constitutes an `atom' depends on the usage (semantics) of
the client of Syntax domain. So, it is trying to encourage more typed
and semantics-based manipulation of syntax trees.
Logged In: YES
user_id=1312732
Originator: YES
Except that a call to "getOperator S" when "S" is an atom in a SExpression leads to a runtime error. There appears to be no way to detect the existence of an atom from a Syntax without converting the Syntax to an SEx and guarding against it being an atom.
Logged In: YES
user_id=1496011
Originator: NO
One does not call getOperator unconditionally -- just like one does not access
a Union member unconditionally. If you think of Syntax as an `advanced' union,
then you see that you have to test whether you have the right elements:
The functions
_case: (%, [|Integer|]) -> Boolean
++ x case Integer is true is x really is an Integer
_case: (%, [|DoubleFloat|]) -> Boolean
++ x case DoubleFloat is true is x really is a DoubleFloat
_case: (%, [|Symbol|]) -> Boolean
++ x case Symbol is true is x really is a Symbol
_case: (%, [|String|]) -> Boolean
++ x case String is true is x really is a String
nils?: % Boolean
are precisely there to support type-based manipulation and query.
Logged In: YES
user_id=1496011
Originator: NO
http://sourceforge.net/mailarchive/forum.php?thread_name=87ejci48qz.fsf%40gauss.cs.tamu.edu&forum_name=open-axiom-patches