range->vector Marc Nieper-Wißkirchen 01 Sep 2020 11:29 UTC

It makes sense to add the following restriction to "range->vector":

"It is an error to modify the vector returned by range->vector."

(This allows for a more flexible implementation of ranges and
prohibits possibly needless copies.)

If modifying the vector result is really necessary, one could add a shortcut

(define (range-copy->vector range)
  (vector-unfold (lambda (i) (range-ref range i)) (range-length range)))