|
|
|
|
|
by amelius
4104 days ago
|
|
I don't understand why people would want to do mathematics in imperative languages. (Yes, I understand imperative languages are faster, but why not just keep the imperative parts for the "inner loops", nicely isolated, and a functional core for everything else?) |
|
R isn't exactly what I'd call your typical imperative language. It's more like the love child of APL and Scheme, with random bits thrown in by a bunch of statisticians.
Loops are almost never used in R, since pretty much everything is a vector (or some sort of data structure made of vectors), you simply apply functions to vectors and it maps over the whole thing.
Of course, the C, C++ and Fortran bits are 'imperative', which is kind of the structure you describe anyway (functional, vectorized R language which calls down to a bunch of C/Fortran functions).