On Thu, Nov 17, 2011 at 01:36:38PM +0100, Ralf Hemmecke wrote:
>> 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.

I thought that the cost of parsing by FriCAS from  *.input  is much 
greater than the cost of the proper evaluation. This is parsing a 
Spad program and data from a string, it involves analysing arities,
setting parentheses, and so on, a generic syntax is complex to parse.

The matter is that in a CAS, the output string needs to look nice, but 
it is usually difficult to parse from, takes quite a cost.
 
This is why I thought of the interface at such a level where most of
parsing is ready, an I thought that it was Lisp.

I have already forgotten of Lisp, all right.

Now I see, how to use only  a string interfcace, *.input and Spad. 
Certain operations must prepare a string which represents a data which 
is "almost parsed". And these operations are programmed in Haskell and 
in Spad.

>> [..]
>>    class AxiomParse a where  toAxiom   :: a ->  String
>>                              fromAxiom :: a ->  String ->  a
>> [..]
>>
>> 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.

Again, I expect that this builtin parser of FriCAS will parse the data 
like  "f = (x^2 + 4*x*y + 5*y**3)"  much longer (probably) that it takes 
the proper evaluation of  factorIntPoly_axiom(f).
Instead I intend to write in Spad

            let str    = inputFromSocket;
                f      = fromDoCon str;
                res    = factorIntPoly_axiom(f);
                resStr = toDoCon res;
            in  outPutToSocket resStr

(change the syntax to FriCAS).
And this is put in  *.input  for FriCAS.
Here  str  is easy to parse by  fromDoCon,  because it is prepared so,
and  fromDoCon  is programmed (in Spad) specially for this format of  
str.

Regards,

------
Sergei

-- 
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