On Thu, Feb 16, 2012 at 08:07:16PM +0100, Waldek Hebisch wrote:
> Bill Page wrote:
> >
> > It is important to remember that
> > in Spad all types are static and must in general be fully determined
> > at compile time.
>
> No. _Categories_ are static and must be determined at compile
> time. Normal types are dynamic.
The book writes about this.
> Of course, Sergei will
> have trouble because apparently he wants to work on
> arbitrary type (for which Type is appropriate category),
> while to do operations he needs more specific categories.
>
I do have trouble.
Trying to find out whether really the whole project has failed.
I replaced the `dom' field in the record with dDom.
Parsing lexemes : List String by dParseL does the following.
ParseRes ==> Record(dDom: SetCategory, val: Any, remLexs: List Lexeme]
ANY1 ==> AnyFunctions1
"(" "I" lexs ")" lexs =>
parses integer to
[Integer :: SetCategory, coerce(n) $ANY1(Integer), remLexemes]
:: ParseRes
"(" "Fr" <numInput> <denomInput> ")" lexs =>
parses a fraction over a domain D,
D being defined from recursively parsing <numInput>:
resN := dParseL <numInput> ...
DA := resN.dDom :: SetCategory
D := DA pretend IntegralDomain
--
-- Otherwise one cannot build a fraction. And as a fraction is
-- input, it is presumed IntegralDomain.
n := retract(resN.val) $ANY1(D)
...
d :=
FD := Fraction D
fr := (n/d) :: FD
[FD :: SetCategory, coerce(fr) $ANY1(FD), remLexemes] :: ParseRes
"(" "UP" varLexeme <sampleCoefInput> <monomialListInput> ")" lexs =>
parses UnivariatePolynomial over the domain R,
R is defined after computing dParseL(<sampleCoefInput> ..)
...
pretend CommutativeRing, coerce(..)$ANY1(..), retract(..)$ANY1(..),
...
All this works (I ran it only for Integer and Fraction Integer)
-- except the part of summing of the parsed monomials to a polynomial.
This part does not even compile, and I cannot understand the messages.
So far, I trye twisting the signatures various ways.
May error are being fixed.
But I do not know which ones cannot be fixed.
Because I have not a general idea of whether my usage of
SetCategory, pretend, coerce(..)$ANY1(..),
and retract(..)$ANY1(..)
is correct.
We'll see further. After several days I'll, probably, give up.
On the other hand, FriCAS does have the `parse' function ...
Regards,
------
Sergei
[email protected]
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.