Hacker News new | past | comments | ask | show | jobs | submit login
A basic Lisp interpreter in R (github.com/dirkschumacher)
64 points by juliuste on July 17, 2017 | hide | past | favorite | 16 comments



Ihaka (co-creator of R) may still be working on a new statistical programming language based on Common Lisp.

https://www.stat.auckland.ac.nz/%7Eihaka/downloads/Compstat-...


That was the inspiration behind Incanter[1], but I haven't heard about efforts by R. Ihaka beyond his writings/presentations 2008-2010 or so.

[1] http://incanter.org/


If you enjoy this sport, there's also Make-a-Lisp (MAL), an ongoing project to write lisp in every programming language:

https://github.com/kanaka/mal

In particular, here's their R version:

https://github.com/kanaka/mal/tree/master/r


"Implement a Lisp" seems to be Lisp's version of "rewrite it in Rust."


If done for educational purposes then there isn't anything wrong with that.


You say that like there's something wrong with rewriting it in Rust.


TeX could be a tough one :)


I wonder why it hasn't been added to MAL yet:

https://bitbucket.org/hak7a3/lisp-on-tex

I guess because it didn't implement lisp itself, since you still have to use \ to invoke macros.


This is brilliant. It kind of reminds me of hy (https://github.com/hylang/hy) in addition to Norvig's lis.py that the author cites as inspiration.

I feel like lots of folks in the R community secretly or not-so-secretly pine for lisp. My own "someday project" is to implement some portion of R in Racket—"Arket". Of course all the native libraries that have been wrapped in R are the tricky bit.


> Of course all the native libraries that have been wrapped in R are the tricky bit.

Everything in R is an SEXP struct. The native code is all shared libraries on Linux and Mac, and mostly DLLs on Windows. There should be almost no problem calling the native libraries if you have an existing R installation.

That doesn't apply if you are talking about a complete reimplementation of R, but that would be a massive project, in which case calling native libraries would be of little relevance.


From one of the linked issues, a "Lisp-like R": https://github.com/chanshunli/jim-emacs-fun-r-lisp


You can also open a lisp interpreter and open an R session from here. Probably more efficient.

If you want to open a lisp repl inside R you can just open an R session and write:

system("sbcl", intern=FALSE)

That's all... use intern true if you want to save the session to an R object

foo <-system("clisp", intern=TRUE)


One of the point's is that you can use R's functions in a LISP-like language.


In that case, why not just embed an R interpreter inside Lisp? I've published a slightly modified fork of RInside that lets you embed R inside anything with a C FFI[1]. Tested only on Linux.

[1] https://bitbucket.org/bachmeil/rinsidec


Call an R session directly from a Lisp repl then.


R with Lisp syntax. Cool stuff.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: