Is the beginner confusion then simply going to shift to "why is 'for' w/ 'range' fast but 'for' w/ 'other-list-function' is not?"
(Not trying to be negative -- I just wonder if it might just further delay people's realizing there are both functions and special syntactic forms for things like 'for', 'match', etc) On Tuesday, January 3, 2017 at 1:44:58 PM UTC-5, Alexis King wrote: > > 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-dev/76981dbd-f8a2-4a1b-9e9c-ba9ee4867662%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
