Yihui Xie, the author of the knitr package for R, was kind enough to write 
another R package https://github.com/yihui/runr that allows an author to 
specify

engine='julia'

as a knitr chunk option.  

knitr allows for literate programming by processing a file in LaTeX or 
Markdown with embedded chunks of code that are evaluated.  Usually the 
evaluation is of R code chunks but this option allows for Julia code to be 
evaluated.

knitr uses R to process the file, extracting code chunks according to given 
patterns and causing them to be evaluated.  For the julia engine a julia 
process is initialized and set to receive messages over a socket, evaluate 
the text passed to it and return the result over a socket.  See

https://github.com/yihui/runr/blob/master/inst/lang/julia_socket.jl

I don't know a lot about ZMQ but I do know that there are bindings for ZMQ 
in both Julia and in R.  It seems to me that this would be a cleaner 
mechanism for passing strings to a julia process, evaluating them, and 
returning the result.

Does this seem to be a reasonable approach?  Are there other mechanisms I 
should consider instead?


Reply via email to