Closed danm0nster closed 2 years ago
Thank you for a thorough list of examples! Supressing the last output would be against the behaviour with other languages and in general not desirable, but catching NULL should be doable. I'll look into it once I am back from the mountains ;-)
Thanks for the quick reply! Enjoy the mountains!
OK, I've taken a closer look. Printing the output of the last command is definitely desirable and will continue. The fact that using print
leads to double printing is a bit unfortunate, but would be rather tricky to fix correctly, so it will stay as well. As for handling NULL - I am a bit surprised that this is happening, but it has to be fixed in SageMath itself. I've created a ticket for that: https://trac.sagemath.org/ticket/34378#ticket
If the language is set to R the output of the last command is always shown. This makes is quite hard to get clean output because of the automatic printing. In addition, if the output of the last command is
NULL
it will result in sagecell printing this:Quite often I just want the output to be a plot and nothing else. But this seems to be impossible.
As an example the following code gives the output shown below. Note the grey box above the plot which at least it empty, but I would prefer not to have at all.
IMO it would be preferable to suppress printing of the last command, since it is very easy to add a
cat()
orprint()
whenever output is needed. Also, since many R functions return the valueNULL
the only way to get rid of the rather verbose NULL message above is to print something, even if it is not needed. But to exacerbate things this will then be printed twice with the current handling of output from R.As an example, the code input
results in the output
This is because
cat()
returns the valueNULL
. So, instead we can use print, which returns the same string that is being printed, so that it will be printed twice. See below for input and output:Input:
Output:
Perhaps there is s clever workaround that I haven't found. But if there isn't, it would be nice to either remove this automatic printing of the last command or at least suppress printing of
NULL
values.