On Thu, Mar 08, 2012 at 06:45:34PM +0100, Ralf Hemmecke wrote:
>>> Even more is true. If you connect to FriCAS and keep the connection
>>> open. Then you probably just have to transfer the data once per session.
>
>>> In other words, you basically talk from Haskell with the FriCAS interpreter.
>>>
>>
>> I do not understand this.
>> I think, it is faster for DoCon to "talk" with
>>
>>    the compiled Spad function  parseCall  +  applying this call +
>>    read/write  of Axiom for  String  and the  two _named pipes_.
>
> Oh, maybe I don't yet understand your design. Or maybe I don't  
> understand FriCAS, but I wouldn't know how to talk to fricas other than  
> via the interpreter.

The Axiom interpreter evaluates the below loop of  `repeat' :

------------------------------------------------ fifoFromA.input -------
toA   : TextFile := open("toA",   "input")
fromA : TextFile := open("fromA", "output")
repeat
  iStr := readLineIfCan! toA  
  if iStr case "failed" then 
                        (output ""; output "input -> failed"; break)
  output "iStr = " iStr "\n"
  strings  := split(iStr, char ";") $String
  strings' := map(parseEvalShow, strings)            --
  str      := concat intersperse(";", strings')
  resStr   := concat[str, newline() :: String]
  writeLine!(fromA, resStr)
  flush(fromA)
------------------------------------------------------------------------

`repeat' 
(1) inputs a string from the named pipe  toA;
(2) splits to to several  call inputs,  each of type  String;
(3) applies  parseEvalShow str  to each call input  str.
(4) writes back to the pipe "fromA" the result strings  strings'.

(several calls are transferred at a time, in order to possibly reduce 
the number of calls for input/output with pipes).

Here             parseEvalShow : String -> String

is programmed in Spad, compiled and loaded before running  
                                                  fifoFromA.input.
The main Axiom part is in  parseEvalShow:

    parseCall,  evaluate it by applying the head function, 
    output to String.

This all I mean by saying 
     "DoCon talks with the compiled  Spad  function  parseEvalShow:
      parseCall + applying this call + read/write  of Axiom".

For example, for factoring  -4x^3 +5x^2 +6  : UP(x, INT),  it is input  
 
    "(factor [(P = UP x INT)]          -- type input table
             (UnivariateFactorize P)   -- package call
             [(Factorize P)  P]        -- signature of `factor'
             [([3 2 0] [-4 5 6])]      -- polynomial
     )"

At the stage of `evaluate', it applies in this example

   factor(<prasedPolynomial>) $UnivariateFactorize(<parsedDomain>)

And I hope that after 
           D := parseDomain(<needed input>) pretend SuchAndSuchRing

(which expresses the above  P )  is computed, the call

                 factor(<prasedPolynomial>) $UnivariateFactorize( D )
will work.
Will it?
If it will, then this would mean `evaluate'.
and the first problem will be the performance of  parseCall.
And the idea to replace the  "parse - interpret"  part of FriCAS with 
my  parseEvalShow.
Such is the situation.

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.

Reply via email to