chickadee » srfi-196 » range-remove->list

range-remove->list pred rangeprocedure

Returns a range/list containing the elements of range that satisfy / do not satisfy pred. The runtime of these procedures is O(s) where s is the sum of the total accessing times of the ranges.

The range-filter and range-remove procedures eagerly compute their results and return expanded ranges. Their average accessing time is O(1).

Examples:

(range->list (range-filter even? (numeric-range 0 10)))
  ⇒ (0 2 4 6 8)

(range-filter->list odd? (numeric-range 0 10))
  ⇒ (1 3 5 7 9)

(range->list (range-remove even? (numeric-range 0 10)))
  ⇒ (1 3 5 7 9)

(range-remove->list odd? (numeric-range 0 10))
  ⇒ (0 2 4 6 8)