A question[1] was asked on Stack Overflow today that used `range` from 
racket/list in a for loop, then was baffled as to why it was so slow compared 
to a manually written loop using named let. To some extent, confusion of this 
sort is unavoidable, since it stems from a confusion about the difference 
between lists and sequences, but this seems like a reasonably common mistake to 
make. Is there any reason `range` cannot be adjusted to cooperate with for 
loops so that it gets compiled like `in-range`?

It seems like there would be two ways to do this: either make for loops 
recognize `range` like `in-range`, or make `range` a macro using 
define-sequence-syntax that just expands to the existing `range` procedure when 
used in an expression context. Both of these could easily be made backwards 
compatible, and it could only make things faster. Is there any technical or 
philosophical reason to not do that before I attempt it?

[1]: http://stackoverflow.com/q/41444129/465378

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-dev+unsubscr...@googlegroups.com.
To post to this group, send email to racket-dev@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/4ED13FA1-45FC-4EAC-94EB-AFF15D91EAB0%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to