3 if(!exists("..types..")) source("types.r")
5 .pr_list
<- function(lst
, print_readably
=TRUE, join
="") {
7 function(e
) .pr_str(e
, print_readably
)), sep
=join
)
10 .pr_str
<- function(exp
, print_readably
=TRUE) {
14 paste("(", .pr_list(exp
, pr
, " "), ")", sep
="", collapse
="")
17 paste("[", .pr_list(exp
, pr
, " "), "]", sep
="", collapse
="")
21 if (length(exp
) > 0) {
23 hlst
[[length(hlst
)+1]] <- k
24 hlst
[[length(hlst
)+1]] <- exp
[[k
]]
27 paste("{", .pr_list(hlst
, pr
, " "), "}", sep
="", collapse
="")
33 gsub("\\\"", "\\\\\"",
34 gsub("\\\\", "\\\\\\\\", exp
))),
35 "\"", sep
="", collapse
="")
42 "logical"={ tolower(exp
) },
44 paste("(fn* ", .pr_str(exp$params
,TRUE),
45 " ", .pr_str(exp$ast
, TRUE), ")", sep
="")
47 "function"={ "<#function>" },
49 paste("(atom ", .pr_str(exp$val
,TRUE), ")", sep
="")