From f3a32de1015eb3008fbdd254e72927f50819c029 Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Fri, 3 Sep 2010 08:10:09 +0100 Subject: [PATCH] alternative printing for the REPL instead of using print(), use str(). Also, be even more cautious about cleaning up in printToString; previously, errors in printing would lead to a sink to a closed fifo... Printing is still not really right, and I forsee that we will end up writing our own printer to get something more lispy. But at least this approach tends not to dump huge tables into the REPL. --- swank.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/swank.R b/swank.R index 99f508b..0a309ef 100644 --- a/swank.R +++ b/swank.R @@ -247,7 +247,11 @@ writeSexpToString <- function(obj) { printToString <- function(val) { f <- fifo("") - tryCatch({ sink(f); print(val); sink(); readLines(f) }, + sink(f) + tryCatch({ + tryCatch(str(val, indent.str="", list.len=5, max.level=2), + finally=sink()) + readLines(f) }, finally=close(f)) } -- 2.39.5