On Wed, 10 Jan 2018, Berkeley Churchill wrote:

(@Jori: unfortunately starting one process and doing all the computations at once won't work for us because we need to dynamically generate the n+1st computation based on the output of the nth computation.  We could theoretically port all that logic to python/sage, but we don't really think that's worth it right now)

Maybe you should then use pipe? First

mkfifo thepipe
./sage -q < thepipe > thepipe

and on the another window I tested with

jm58660@j-op7010:~/sage$ echo 1+2 > thepipe
jm58660@j-op7010:~/sage$ read result < thepipe
jm58660@j-op7010:~/sage$ echo $result
sage: 3
jm58660@j-op7010:~/sage$ tmp=$(echo $result | cut -f 2 -d ' ')
jm58660@j-op7010:~/sage$ echo $tmp+3 > thepipe
jm58660@j-op7010:~/sage$ read anotherresult < thepipe
jm58660@j-op7010:~/sage$ echo $anotherresult
sage: 6
jm58660@j-op7010:~/sage$ echo quit > thepipe

Or maybe use Sage as controller part, i.e. call C++-program from Sage instead of calling Sage from C++-program?

--
Jori Mäntysalo

Reply via email to