rlangQQ_show <- function(x) paste("'",gsub("'","\\\\'", x, fixed=T),"'", sep='') rlangQQ_toTree <- function(e) if (is.symbol(e)) paste('Node', rlangQQ_show(e), '[]') else { paste('Node', rlangQQ_show(e[[1]]), if (length(e) < 2) '[]' else paste('[', paste(sapply(2:length(e), function(i) rlangQQ_toTree(e[[i]])), collapse=', '), ']') ) }