Anyway, I see from your response that the approach with sending the
Lisp data will not do.

I don't know why you mention LISP all the time. That lisp is the underlying system in FriCAS is just a technical detail. If you want to communicate with FriCAS, you should do it in SPAD, or rather in the interpreter language of FriCAS. Just send to FriCAS the same text that you would put into a *.input file in order to compute what you want. Then parse the output (basically a big string) by Haskell means back into something that docon understands.

Basically this is the way that Sage and FriCAS were/are connected. Maybe inefficient and losing all the FriCAS type information, but it somehow works.

On the other hand, I believe now that I know how to satisfactory reduce
the cost of the  text parsing,  at both ends in DoCon and in Axiom.
Introduce to DoCon the class

   class AxiomParse a where  toAxiom   :: a ->  String
                             fromAxiom :: a ->  String ->  a

and its instances for the constructors
Vector, Matrix, Pol, Fraction, Residue, ...  used in DoCon.
toAxiom  produces such a string which can be fast parsed by Axiom.
          fromAxiom sm str
   parses a string to the DoCon element of the domain of the sampe  sm,
   where  str  is certain string which is easy to parse by DoCon.

Similarly,   Category DoConParse(a) {fromDoCon : String ->  a,
                                      toDoCon   : a ->  String}
is added to the Axiom library

Well, of course, you can put the parse-part on the SPAD or on the HASKELL site, whatever is better for you, but if Docon directly produces the command line syntax of FriCAS, then FriCAS can basically just take your string and execute it, because there is already a builtin parser for the interpreter language.

For example, for an integer polynomial  f,  DoCon will send not
the string  "(x^2 + 4*x*y + 5*y^3)"  but something like

"Pol  Integer  (Vars "x" "y") (Mons (1, [2,0]) (4, [1,1]) (5, [0,3]))"

-- may be, with additional tags, to make possible fast parsing in Axiom
by the operation  fromDoCon.  Parsing this to Axiom does not need to
check operation arities, precedence, types etc.

Yes, you can do this. And maybe it is even more precise. But anyway, you have to invent some protocol and map FriCAS types to DoCon types and vice versa.

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.

Reply via email to