objpascal, r: Support catchless try*.
[jackhill/mal.git] / r / step8_macros.r
index 54b1d13..d8d3ba1 100644 (file)
@@ -75,9 +75,8 @@ EVAL <- function(ast, env) {
     repeat {
 
     #cat("EVAL: ", .pr_str(ast,TRUE), "\n", sep="")
-    if (!.list_q(ast)) {
-        return(eval_ast(ast, env))
-    }
+    if (!.list_q(ast)) { return(eval_ast(ast, env)) }
+    if (length(ast) == 0) { return(ast) }
 
     # apply list
     ast <- macroexpand(ast, env)
@@ -160,7 +159,7 @@ Env.set(repl_env, "*ARGV*", new.list())
 
 args <- commandArgs(trailingOnly = TRUE)
 if (length(args) > 0) {
-    Env.set(repl_env, "*ARGV*", new.listl(slice(list(args),2)))
+    Env.set(repl_env, "*ARGV*", new.listl(slice(as.list(args),2)))
     . <- rep(concat("(load-file \"", args[[1]], "\")"))
     quit(save="no", status=0)
 }