>> As I currently understand, there are in principle two ways to 
>> achieve this.
>> 
>> (A) using pexpect and communicating with the FriCAS command line 
>> (and probably heavily relying on ioHook, (B) adding a zeromq 
>> library to FriCAS and thus turning FriCAS directly into an IPython 
>> kernel.

> I do not see why you think that there are only two alternatives and 
> especially why you put stress on second one.

I'm not claiming that I understand everything in full detail.

>From what you wrote, I have the impression that you think of the connection

  notebook --(a)-- FriCAS

as something that is done using Python code. Yes, it can probably be
done that way, but then it would basically look like

  notebook --(a)-- K --(b)-- FriCAS

and that's not what I favour.

I still may have the wrong understanding of ZeroMQ, but for me it's a
library. So while on the notebook side there is definitely Python,
because all that IPython stuff is done in Python, the FriCAS side needs
no python at all. That was the reason why I cited
http://zeromq.org/bindings:cl , i.e. connection from the fricas side
would be done via a lisp library.

As I see it, I would have to change the definition of serverReadLine
because that is the place from where FriCAS gets its input.

https://github.com/fricas/fricas/blob/master/src/interp/int-top.boot#L199

So I would have to change something here.
https://github.com/fricas/fricas/blob/master/src/interp/server.boot#L73

I don't yet understand all of that code, but since I would basically
have FriCAS run via "fricas -nosman", I guess, the only important line is

not $SpadServer =>
  read_-line(stream)

and this would have to be done via listening on the port of the zeromq
connection and get the information from there.

I haven't yet identified the actual output routine, but it's probably
some subroutine below sayString. (But I guess, it will be more
complicated, since I also see TERPRI used at other places, so it's not
totally clear where the lowest communication place is.)

What I'm not sure about is how Ctrl-C or the zeromq heart-beet are handled.

> Extra comment: FriCAS is single threaded and uses 'select' system 
> call to multiplex between input sources.

OK, thanks. But I guess, it shouldn't concern my simplistic view of the
system. As I said, I'd rather call AXIOMsys directly, not all these
processes that are usually started by fricas (sman).

> If you want your interface to cooperate nicely with graphics,

I don't. Yes, that's the weak point of my approach. It would exclude
graphics and hyperdoc. Given my work on a HyperDoc replacement, I don't
see a big problem with losing that (YMMV). Losing graphics is, of
course, bad, but I (almost) never use FriCAS graphic anyway, so it
wouldn't be a big loss for me. And furthermore I'd be much more happy,
if we had someone (re-)programming a better graphics system with SVG or
mathplot output. Remember Sage also embeds mathplot figures into their
notebook.

I'm pretty sure that you would be against such an approach, but let me
say that I am more concerned with the current textual frontend than with
that graphics stuff and I will certainly not be asking you to include
such code into FriCAS if it removes features that you or other people
find important. In other words all that work on an IPython connection
can be done in a branch and live there until also a better graphics
system is in shape. Maybe the only thing that I would ask for is to
enable an option (similar to -nosman) that lets users choose there
preferred interface.

Anyway, we are currently only talking about a plan. I fear that without
your help (i.e. pointing me to the right place in the code and probably
also reviewing my code) I'll not be able to turn that plan into working
code.

>From a first look at the code I got the impression that I would first
have to abstract all the input/output to go through one dedicated
function (i.e. not using LISP function directly in the code). It looks
as if macros.lisp and msgdb.boot would be a good start to look at.
It seems that TERPRI and PRINTEXP are the lowest-level output function,
but they appear everywhere (even (probably unnecessarily) in .spad code).

I'm not quite sure whether that would handle )read and )spool cases,
since they should probably not be flowing over the zeromq connection.

Any hints are welcome.

Ralf

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to