# [racket] Typed Racket and macros expanding to for*:

2012/7/25 Matthias Felleisen <matthias at ccs.neu.edu>:
>*
*>* Yes, the #:when clause has to be last. I got my reasoning backwards.
*>*
*>* Do try both and report back. I am curious how expensive the ec is compared
*>* to the #:when test.
*
It turned out that the for*/fold + #:when solution didn't behave as expected.
Here is the documentation of for/vector :
--
(for/vector (for-clause ...) body ...+)
(for/vector #:length length-expr (for-clause ...) body ...+)
Iterates like for/list, but the result are accumulated into a vector
instead of a list. If the optional #:length form is used, then
length-expr must evaluate to an exact-nonnegative-integer?, and the
result vector is constructed with this length. In this case, the
iteration can be performed more efficiently, and terminates when the
vector is full or the requested number of iterations have been
performed, whichever comes first.
--
I interpret this paragraph to mean, that
(for/vector #:length 10 ([i (in-naturals)]) i)
ought to terminate - but it doesn't !
The question is now, whether the bug is in the documentation, the implementation
or my interpretation.
/Jens Axel