0

I am writing a function that maps lists of lists of bools invectively into lists of bools. This is my code:

y=[False| y<-[0..]]    
encode :: [[Bool]] -> [Bool]
encode x:xs =   (zip1 x y):True:True:(encode xs)
encode []=[]

The zip1 function just takes two lists and writes them alternating into a new list.

I'm getting the error message

Parse error in pattern: encode

Why do I get this error message?

Chris Martin
  • 30,334
  • 10
  • 78
  • 137
user3726947
  • 501
  • 5
  • 16

1 Answers1

5

Function application has higher precedence than :

Thus, Haskell parses

encode x:xs 

as

(encode x):xs 

which makes no sense. You need

encode (x:xs) 
John Coleman
  • 51,337
  • 7
  • 54
  • 119