fiddlerwoaroof/data-lens

Need to ensure adjustability for vector-push-extend

Closed this issue · 1 comments

(defmethod stepper ((it (eql 'vector-builder)))

The stepper for vector-builder uses vector-push-extend. vector-push-extend is documented to give an error if it needs to extend the vector and it is not adjustable: http://www.lispworks.com/documentation/HyperSpec/Body/f_vec_ps.htm
"An error of type error is signaled by vector-push-extend if it tries to extend vector and vector is not actually adjustable. "

So the builder-for-input method must ensure that the vector is adjustable.
Adding :adjustable t to the make-array call is the simplest solution.

This is a good point. I probably should document this requirement for into.

In the normal case (getting an array from the result of calling INIT), this is guaranteed:

data-lens/transducers.lisp

Lines 162 to 163 in c80aff0

(defmethod init ((it (eql 'vector-builder)))
(make-array 0 :fill-pointer t :adjustable t))