R language (or S) is something I occasionally deal with. It is known for good libraries for statistics, but its core is a rather general programming language; it is far from being as specialized as advertised. R had even been mentioned on
LtU a couple of times.
R has a lot of Lisp hidden behind a C-like syntax. Lexical scoping, lambdas, lists.
Something I learned today is
Recall
and
call
. The latter is not unlike a
(quote)
..
fac <- function (n) if (n == 0) { 1 } else { Recall(n-1) * n };
fac(10)
eval(call(fac, 10))
The downside is that the implementation is very slow. Since most operations vectorized, the argument is that it does not matter. Realistically, nobody is going to do anything about it.
In terms of inter-op with libraries, would it not have been much better to have it (and its wonderful libraries) run on top of a more widely accepted runtime, or even a Scheme or CL..
UPDATE:
here is a nice blog on function argument handling semantics in R, which turns out to be pretty complicated.
UPDATE: I finally found the draft of the R
Language Definition. The section on evaluation and argument matching is particularly interesting.
No comments:
Post a Comment