Skip to content
Prev 202026 / 398503 Next

Iteration idioms & laziness

Alexander S?ndergaard wrote:
In this case

   sum(as.numeric(seq(1, 1e6)))

or according to Gauss

   1e6 * (1e6+1) / 2

but for more complicated problems it might be sensible to go the loop 
way ...

Uwe Ligges