jupyter-xeus / xeus-r

Jupyter kernel for the R programming language
Other
42 stars 6 forks source link

evaluate expressions, and `print()` with visibility handling #8

Closed romainfrancois closed 1 year ago

romainfrancois commented 1 year ago
image

First take on this. This evaluates each expression, and print them, respecting their visibility, i.e. cat("hello") would return NULL invisibly and (cat("hello")) would return NULL visibly:

image

internally this uses Rf_PrintValue() see here for details https://github.com/r-devel/r-svn/blob/cacdcc725217a01330d1d92c65f8a4b77bef5015/src/main/print.c#L27

so we get the same thing as if it would have been auto printed in the console:

image

except that there is an extra \n between "hello" and "bonjour".

Eventually the idea is to do something else than print()ing, if possible in a way that can be extended by third party 📦 .