[R] making-a-lisp implementation of R
Jeremie Juste
jeremiejuste at gmail.com
Sat Oct 28 10:18:14 CEST 2017
Hello,
I was trying to make my R implementation of making-a-lisp
https://github.com/kanaka/mal/tree/master/
And to my surprise I got stuck in the starting blocks. There is already
a mal implementation of R here
https://github.com/kanaka/mal/tree/master/r but it uses rdyncall package
which is not on CRAN anymore and I thought it would be fun to try my
skills here
The following code is step0_repl.r but it does pass the test. Do you
have any idea why?
READ <- function(arg){
return(arg)
}
EVAL <- function(arg){
return(arg)
}
PRINT <- function(arg){
return(arg)
}
REP <- function(arg){
PRINT(EVAL(READ(arg)))
}
tryCatch({
while(TRUE){
cat("user> ")
input <- tryCatch(readLines(n=1),error=function(e) character(0))
if (identical(input,character(0))) {
stop
} else{
if(input==""){next} else
cat(REP(input),"\n",sep="")
}
}
},error=function(err){
cat( err$message,"\ninput: ",input,"\n", sep="")
})
Best regards,
Jeremie
More information about the R-help
mailing list