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] etcEach 9th bit is a parity bit which is checked using this function:type Bit = Intparitychecker :: [Bit] -> Boolparitychecker xs | length xs == 9 && ((sum (init xs)) `mod` 2) == (last xs) = True| otherwise = FalseIn 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.I want to end up with all the 9 bit chunks which pass the filter. So my end type should be [[Bit]]paritychecker requires a list - eg [Bit] . So I want to run paritychecker on each element returned from chop9. How do I do that?Example encoded data stream:[1,0,0,0,1,1,1,0,0,1,1,1,0,1,1,1,0,0,1,0,1,0,0,1,1,0,0,0,1,0,0,1,1,1,0,0,0,0,1,0,1,1,1,0,0,1,0,0,1,1,1,1,0,1]Angus
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners