At Thu, 19 Aug 2010 18:45:43 -0400, sa...@racket-lang.org wrote: > +(define-syntax for*/flvector > + (lambda (stx) > + (syntax-case stx () > + ((for*/flvector (for-clause ...) body) > + (syntax/loc stx > + (list->flvector (for*/list (for-clause ...) body)))) > + ((for*/flvector length-expr (for-clause ...) body) > + (syntax/loc stx > + (for*/flvector (for-clause ...) body))))))
I'm not comfortable with overloading based on the number of forms (the same with `for/vector' and `for*/vector'), since the `for' forms normally allow multiple expressions and internal definitions in the `for' body. It would be better to use a `#:size' keyword when supplying a specific size instead of relying on the number of forms within `for/vector'. > +...@defform*[((for/vector (for-clause ...) body) > + (for/vector length-expr (for-clause ...) body))] Along the same lines: the `body' meta-variable must always be followed by `...+' in a syntax description. If you allow only one expression, it's `expr' insteda of `body'. (But I think the solution here is to change the syntax so that the docs will have `body ...+'.) > +...@defform*[((for*/vector (for-clause ...) body) > + (for*/vector length-expr (for-clause ...) body))])]{ > + > +Iterates like @scheme[for] or @scheme[for*], but the values of the > +...@scheme[body] expression are placed in a vector whose length is the > +number of iterations. The optional @scheme[length-expr], if present, > +is evaluated to determine the length of the vector in advance of the > +iteration; if @scheme[length-expr] is provided, the computation is > +more efficient.} The documentation doesn't answer the question that you asked before, which is what happens when the result of `length-expr' doesn't match the number of iterations. There appear to be no tests for that case, either. _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev