[racket-dev] exact nonnegative integers as sequences?
An hour and a half ago, Matthew Flatt wrote:
> I often write
>
> (for.... ([i (in-range N)]) ...)
>
> In cases where the loop overhead is not significant (i.e., I don't
> care whether the compiler can tell that I'm iterating through
> integers), it would be nice to write just
What's the overhead?
> (for.... ([i N]) ...)
>
> which would require that integers are treated as sequences.
+1 (I actually assumed it was doing that, it's strange that I never
tried it...)
> Would anyone object to making an exact, nonnegative integer `N' a
> sequence equivalent to `(in-range N)'?
(No, but I still don't see the performance reason.)
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!