inst/examples/ihasNextExample.R

library(itertools)

n <- 100
it <- ihasNext(icount(n))

total <- 0
while (hasNext(it))
  total <- total + nextElem(it)

print(total == sum(seq(length=n)))

Try the itertools package in your browser

Any scripts or data that you put into this service are public.

itertools documentation built on May 2, 2019, 6:16 p.m.