Later this will grow, to include a few kinds of streams in a unified
way, and possibly change the sequence protocol to a point where these
functions are not causing such big runtime penalties.
including adding some uses of `with-module-read-parameterization'
so that `read-accept-lang' is set right anyway; still, so many
many places just set `read-accept-reader' to #t that making
`read-accept-lang' #f by default looks like too big of an
incompatibility
if no future thread is running the future; also adjust the
policy for suspending a future so that even synchronized
operations can suspend if there's other work to be done;
also also fix `current-future' for nested `touch'es and when
parallel futures are disabled
Now use for/fold to thread the index through the iteration form, so
that all variants can take advantage of the optional #:length
argument. Previously, only the for/vector and for/flvector used the
The behavior when #:length does not match the number of iterations has
changed: iteration stops when either the vector is full, or the
requested number of iterations has been achieved, whichever comes
first. If #:length is larger than the number of iterations performed,
then the remaining slots in the vector are filled with the default
argument of (make-vector ...), which is currently 0.
- Now the faster forms take a #:length keyword to designate the length
of the vector to pre-allocate.
- The for/[fl]vector forms take multiple body expressions and set the
vector component to the value of the last one.
- When given a #:length argument, the for/vector and for/flvector
forms check that the iteration is not exceeding the given length,
raising exn:fail if it does.
- Test cases for the multiple body expressions and the exception for
excessive iterations have been added.
- Doc modifications to bring the docs in line with the new forms.
- Doc modifications to note that the #:length versions of the form
*may* all the computation to be performed more efficiently, and
stating that it "is an error" if the given length-expr does not
produce a valid length for a vector that matches the number of
iterations for the loop.
- Note that no test is made for a number of loop iterations that is
smaller than the given vector length. Also, the for*/[fl]vector
forms do not optimize when given a #:length argument. These are
areas for future improvement.