On Tue, Apr 11, 2023 at 09:45:28PM +0200, Ralf Hemmecke wrote: > > This is done by using shell redirection to a file and returning content > > of the file. > > Yes, but as the subject said, is there a way without redirection and > temporary file?
Well, without redirection output would to to terminal, so redirection is a must. And if you want output as a single "piece", then you need temporary storage and temporary file is classic way to get such storage. Of course, all needed redirections and buffering could be hidden in an utility function. AFAICS need to run external programs and capture output is rare enough that nobody bothered to write a special function. > Meanwhile I have found this. > > https://github.com/sellout/external-program > > Waldek, do you think that would be a way to communicate with external > programs, running a shell script or even starting another CAS process (Sage > or whatever) and communicate with it through streams? > > In fact, I am looking for a way to call Sage (in a syncronous or > asynchronous way) from within FriCAS You do not say what you want from Sage. IMO "proper" way of using external programs involves appropriate communitation protocol and ways to translate data. Several years ago GAP folks wrote an article about interface of this kind. They based their protocol on Open Math, which is troublesome because semantics of Open Math is underspecified (simple things are standarised, anything "interesting" seem to be vendor specific extention), but as general direction it looked about right. IIUC Singular implemented the same protocol. OTOH I am not sure if there are good ways to get information out of Sage. Many years ago Martin Rubey tried "Pyton in Lisp" package. The idea was to run Pytion code from FriCAS and in that way get access to Sage. IIRC this worked fine for pure Pyton, but Sage is kind of opposite to "pure Python": most code is in external programs. -- Waldek Hebisch -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/20230413141808.mdigktbh6h2hsfa3%40fricas.math.uni.wroc.pl.
