Re: [Haskell-cafe] List comprehensions with Word8

2013-05-16 Thread Casey McCann
At risk of belaboring the now-obvious, note that the empty lists begin at 1, which is 10^8, and thus the first power of 10 evenly divisible by 2^8. The largest value in the list for each 10^n is likewise 0 modulo 2^n. (Figuring out why the sequence has those particular multiples of 2^n is

Re: [Haskell-cafe] List comprehensions with Word8

2013-05-16 Thread Steve Schafer
On Thu, 16 May 2013 23:15:33 +0200, you wrote: >Hello everyone, > >I was playing with Word8 and list comprehensions and >the following examples came up. I have to admit the >behavior looks quite strange because it does not seem >to be consistent. Can someone shed some light on reason >behind some

Re: [Haskell-cafe] List comprehensions with Word8

2013-05-16 Thread Tikhon Jelvis
This happens because of how fromInteger is defined for Word8. It maps integers to integers mod 256. Also remember that 10 is actually fromInteger 10, in all of your examples. So your example is actually equivalent to [0..1 `mod` 256]. On May 16, 2013 2:19 PM, "Jose A. Lopes" wrote: >

Re: [Haskell-cafe] List comprehensions with Word8

2013-05-16 Thread Felipe Almeida Lessa
Prelude> 10 `mod` 256 0 So [1..10] == [1..0]. Cheers, On Thu, May 16, 2013 at 6:15 PM, Jose A. Lopes wrote: > Hello everyone, > > I was playing with Word8 and list comprehensions and > the following examples came up. I have to admit the > behavior looks quite strange because it

[Haskell-cafe] List comprehensions with Word8

2013-05-16 Thread Jose A. Lopes
Hello everyone, I was playing with Word8 and list comprehensions and the following examples came up. I have to admit the behavior looks quite strange because it does not seem to be consistent. Can someone shed some light on reason behind some of these outputs? By the way, I have abbreviated some