String -> Type
String -> parser function
String -> encoder function
(String, String, List(String)) -> application funnction
Waldek, I like that. It somehow reminds me of
https://svn.origo.ethz.ch/algebraist/trunk/aldor/lib/algebra/src/extree/sit_extree.as
But, in fact, in some sense your approach is more general.
Anyway, if Sergei is able to prepare the string that is sent to fricas,
one could prepend each item with the (FriCAS) type it should belong to
and *a parse function from this type* would then parse and read the next
item. And such parse functions could call parse funcions from other
types recursively.
For example. Assume I want to read a polynomial of type UP(x, FRAC INT).
The first thing would be to have a preparation phase where all the
involved types in the expression are listed and given a name. So we
would have
Z:=Integer
Q:=Fraction Z
P:=UnivariatePolynomial(x, F)
In fact that is somewhat similar to constructing these types in a online
session. And one can probably let the FriCAS interpreter do the parsing
for these types.
Then the actual polynomial (for example 3/4*x^3 + 7/5*x + 4/1) that
would be send from Haskell, would look like this
(P (P P P) + (P (Q Z) * (Q (Z Z) / 3 4) 3)
(P (Q Z) * (Q (Z Z) / 7 5) 1)
(P (Q Z) * (Q (Z Z) / 4 1) 0))
General pattern: (RET-TYPE (ARG-TYPES) FUNNAME actual-arguments)
Excuse me. I've simplified x^n a bit.
As Waldek mentioned, in some cases, it might not be enough to have
argument and return types given and one would have to find a way to
package call a certain function.
Does that sound reasonable?
Ralf
--
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.