Friday, December 25, 2009

Lexical Scoping

Is the name of the magic. It is the part of Scheme (a lisp dialect) that R inherited, and its incredibly powerful. I re-factored a loop I wrote into a vector function earlier; the loop took fifteen minuets to run on 24k data points. The re-factored vector equation returns exactly the same data and runs in milliseconds. The explanation for that defies my imagination.