tests/ifilterTest.R

test01 <- function() {
  odd <- function(x) x %% 2 == 1
  even <- function(x) x %% 2 == 0

  actual <- as.list(ifilter(odd, 1:10))
  expected <- as.list(Filter(odd, 1:10))
  checkEquals(actual, expected)

  actual <- as.list(ifilterfalse(odd, 1:10))
  expected <- as.list(Filter(even, 1:10))
  checkEquals(actual, expected)
}

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.