On 2018-10-06 02:06 PM, Aditya Mahajan wrote:
I also want to take this opportunity to express my views on intefacing
with external programs. The file based interaction provided by the
filter module is okay for small projects but it is not ideal. Slightly
better is to use pipes (popen to a REPL) or use FFI (e.g
https://adityam.github.io/context-blog/post/interfacing-with-julia),
but neither of these is easy to implement and needs to be done on a
per-language basis. Henri Menke had a Tugboat article on this as well.
In my opinion, a better long-term option is to write a jupyter client
in lua that can be called by context. Then we can easily interface
with all languages that provide a jupyter kernel
(https://github.com/jupyter/jupyter/wiki/Jupyter-kernels).
The interface of a jupter-client is available here
https://jupyter-client.readthedocs.io/en/stable/index.html. It seems
relatively straight forward (send a JSON message and receive a JSON
message). Translating the JSON messages to ConTeXt should also be
easy. Is there anyone who wants to play around trying to implement this?
I have recently come across the SciLua project
(http://scilua.org/index.html) which has a built-in LuaJIT client for
Rserve (http://scilua.org/rclient.html) and may be relevant to the
discussion. Although it certainly isn't as general as something like
jupyter, leaning on SciLua may be an easier means of getting access to
scientific computation with R and basic numerical methods. I am
personally planning to look into switching from filter to SciLua if it
means that I can get more efficient data transfer between R and ConTeXt.
But I'm a ConTeXt and Lua neophyte so I doubt my personal efforts will
be translatable into something more general like a module.
Stan
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________