Re: [Haskell-cafe] The range operator

2008-04-07 Thread Roel van Dijk
class Enum a where ... -- | Used in Haskell's translation of [n,n'..m]. enumFromThenTo :: a -> a -> a -> [a] So [x, y .. z] becomes "enumFromThenTo x y z". Each instance of Enum is free to implement enumFromThenTo and friends in any way it likes. So with Ints you have [1, 3 .. 10] :: [Int]

Re: [Haskell-cafe] The range operator

2008-04-07 Thread PR Stanley
At 12:28 07/04/2008, you wrote: On Fri, Apr 4, 2008 at 10:49 PM, Andrew Coppin <[EMAIL PROTECTED]> wrote: > More to the point, the range y..z goes in steps of y-z. ;-) [x,y..z] goes in steps of y-x ;-), [y..z] goes in steps of 1 (depending on the type). Could you elaborate please?

Re: [Haskell-cafe] The range operator

2008-04-07 Thread Roel van Dijk
On Fri, Apr 4, 2008 at 10:49 PM, Andrew Coppin <[EMAIL PROTECTED]> wrote: > More to the point, the range y..z goes in steps of y-z. ;-) [x,y..z] goes in steps of y-x ;-), [y..z] goes in steps of 1 (depending on the type). ___ Haskell-Cafe mailing list Ha

Re: [Haskell-cafe] The range operator

2008-04-04 Thread Andrew Coppin
Stefan O'Rear wrote: On Fri, Apr 04, 2008 at 08:58:06PM +0100, PR Stanley wrote: Hi folks [x, y..z] What's the role of x? Cheers, Paul First number in the output; also all pairs differ as much as the first two numbers do. Try e.g [1, 2 .. 10] and [0, 2 .. 10] More to the point, t

Re: [Haskell-cafe] The range operator

2008-04-04 Thread Matthias Kilian
On Fri, Apr 04, 2008 at 08:58:06PM +0100, PR Stanley wrote: > [x, y..z] > What's the role of x? It's the first argument passed to enumFromThenTo. See sections 3.10 and 6.3.4 of the Haskell report. Ciao, Kili -- There's a limit to how many buttons a shirt should have. --

Re: [Haskell-cafe] The range operator

2008-04-04 Thread Stefan O'Rear
On Fri, Apr 04, 2008 at 08:58:06PM +0100, PR Stanley wrote: > Hi folks > [x, y..z] > What's the role of x? > Cheers, > Paul First number in the output; also all pairs differ as much as the first two numbers do. Try e.g [1, 2 .. 10] and [0, 2 .. 10] Stefan signature.asc Description: Digital sig

[Haskell-cafe] The range operator

2008-04-04 Thread PR Stanley
Hi folks [x, y..z] What's the role of x? Cheers, Paul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe