[racket-dev] exact nonnegative integers as sequences?

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Apr 18 11:04:18 EDT 2011

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!


Posted on the dev mailing list.