[r6rs-discuss] Multiple returns from higher-order procedures

William D Clinger will at ccs.neu.edu
Sun Jun 24 13:17:26 EDT 2007


Mike Sperber wrote:
> For `list-sort', OK.  But for `vector-sort' and `vector-map'?  Maybe I'm
> not understanding the issue correctly: You had a great example for why
> allowing mutation would be harmful with `map'---moreover, there isn't
> really any overhead with `map'.  But is the same the case for the
> procedures operating on vectors?

Yes.  With vector-sort or vector-map, if you allocate
the result vector before you call the predicate or
procedure argument, filling in the result vector as
you go, then you will see exactly the same kind of
bug you would see with a map procedure that builds
the result in reverse order and then uses reverse!
at the end.

The R6RS should forbid this class of bugs for
vector-sort and vector-map, just as it does for
map.

Will



More information about the r6rs-discuss mailing list