chickadee » srfi-196 » subrange

subrange range start endprocedure

Returns a range which contains the elements of range from index start, inclusive, through index end, exclusive. Runs in O(1) time. The average accessing time of the resulting range is asymptotically bounded by the average accessing time of range.

Examples:

(range->list (subrange (numeric-range 5 15) 5 8))
  ⇒ (10 11 12)

(range->list (subrange (string-range "abcdefghij") 2 8))
  ⇒ (#\c #\d #\e #\f #\g #\h)