On Sat, 2008-09-27 at 02:09 +0100, Simon Richard Clarkstone wrote:
> Darn, I sent this as personal mail the first time.
> 
> Evan Laforge wrote:
> >> In Haskell,
> >> "The sequence enumFromTo e1 e3 is the list [e1,e1+1,e1+2,...e3].
> >>  The list is empty if e1 > e3."
> > 
> > I like it, since it means that things like [n .. n + length m - 1]
> > work as expected when m is [].  Or say 'map (array!) [bsearch x ..
> > bsearch y - 1]'.
> > 
> > Tangent:  Of course, I would prefer the range be half-open, which is a
> > pretty consistent standard in the rest of the world.  I've had a
> > number of off by one errors from this, and from Array.bounds.  I guess
> > it's too late to fix those, though, even if there were agreement that
> > they need to be fixed.
> 
> It causes problems with types that have an upper bound.  You can't
> express Haskell's [False .. True] as a half-open range for example.

[False .. ] works great, though, whether ranges are closed or half-open.

jcc


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to