Skip to content

Instantly share code, notes, and snippets.

@hadley
Last active December 13, 2021 22:41
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hadley/6195660 to your computer and use it in GitHub Desktop.
Save hadley/6195660 to your computer and use it in GitHub Desktop.
A lighthearted and overly flattering comparison of R to other programming languages: what other comparisons have I missed?

R is like:

  • Clojure, because most objects are immutable
  • Scala, because it combined functional and OO techniques
  • Node.js, because the interpreter is single threaded
  • PHP, because it favours pragmatism over purity
  • Lisp, because it's homoiconic
  • Perl, because OO is (mostly) implemented using the language itself
@crowding
Copy link

crowding commented Aug 9, 2013

@cscheid, R is homoiconic in your more narrow sense. You don't just "have access to" the AST, the AST and in-memory representation of programs is literally a tree of R objects. The R parser constructs a tree of data objects and the R evaluator merely steps over that tree. quote() is nearly a no-op, as it just returns its argument unevaluated.

@crowding
Copy link

crowding commented Aug 9, 2013

Like Haskell, because (some) evaluation is lazy
Like Kernel, because it has fexprs and first class environments and even the control flow forms are just functions
Like Ruby because embedded DSLs are easy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment