elixir, erlang, lua, php, r, vimscript: Fix (first nil) and (rest nil)
[jackhill/mal.git] / r / step0_repl.r
1 source("readline.r")
2
3 READ <- function(str) {
4 return(str)
5 }
6
7 EVAL <- function(ast, env) {
8 return(ast)
9 }
10
11 PRINT <- function(exp) {
12 return(exp)
13 }
14
15 rep <- function(str) {
16 return(PRINT(EVAL(READ(str), "")))
17 }
18
19 repeat {
20 line <- readline("user> ")
21 if (is.null(line)) { cat("\n"); break }
22 tryCatch({
23 cat(rep(line),"\n", sep="")
24 }, error=function(err) {
25 cat("Error: ", err$message,"\n", sep="")
26 })
27 }