Re: [Haskell-cafe] The range operator
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] == [1, 3, 5, 7, 9] but with Chars you get ['a', 'c' .. 'i'] :: [Char] == "acegi" and with Floats you curiously get [1, 3 .. 10] :: [Float] == [1.0, 3.0, 5.0, 7.0, 9.0, 11.0] On Mon, Apr 7, 2008 at 2:07 PM, PR Stanley <[EMAIL PROTECTED]> wrote: > 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? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] The range operator
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? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] The range operator
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 Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] The range operator
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, the range y..z goes in steps of y-z. ;-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] The range operator
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. -- Theo de Raadt ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] The range operator
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 signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] The range operator
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