
Am 31.12.13 19:48, schrieb Angus Comber:
I am getting a list of lists from chop9. I want to somehow filter each element in the list. How do I do that.
I have encoded binary data eg [1,1,0,0,1,0] etc
Each 9th bit is a parity bit which is checked using this function:
type Bit = Int
paritychecker :: [Bit] -> Bool paritychecker xs | length xs == 9 && ((sum (init xs)) `mod` 2) == (last xs) = True | otherwise = False
In the stream (the list) I use chop to retrieve each block of 9 bits as in:
chop9 :: [Bit] -> [[Bit]] chop9 [] = [] chop9 bits = take 8 bits : chop9 (drop 8 bits)
I have been playing with this sort of thing: filter paritychecker ??? chop9 [1,0,0,0,1,1,1,0,0,...]
But doesn't work.
Could a simple typo be the problem?
Shouldn't chop9 .. take 9 bits ... and ... drop 9 bits ... instead of 8?
Harald
--
Harald Bögeholz