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

From: William D Clinger <will>
Date: Sun, 24 Jun 2007 13:17:26 -0400

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
Received on Sun Jun 24 2007 - 13:17:26 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC