chickadee » srfi-196 » range-split-at

range-split-at range indexprocedure

Returns two values: (range-take range index) and (range-drop range index). It is an error if index is not an exact integer between 0 and the length of range, both inclusive. Runs in O(1) time.

Example:

(let-values (((ra rb) (range-split-at (numeric-range 10 20) 5)))
  (values (range->list ra) (range->list rb)))
    ⇒ (10 11 12 13 14)
      (15 16 17 18 19)