chickadee » srfi-196 » range-drop-while-right

range-drop-while-right pred rangeprocedure

Returns a range that omits leading/trailing elements of range that satisfy pred until the first/last one that does not. The runtime of these procedures is asymptotically bounded by the total accessing time of the range. The average accessing time of the resulting range is O(1).

Examples:

(range->list (range-drop-while (lambda (x) (< x 10))
                               (numeric-range 5 15)))
  ⇒ (10 11 12 13 14)

(range->list (range-drop-while-right (lambda (x) (> x 10))
                                     (numeric-range 5 15)))
  ⇒ (5 6 7 8 9 10)