Reputation: 63
Why is there a parse error on this? I insert a list and want to get tuples out. (The top line is correct).
freq :: Eq a => [a] -> [(Int,a)]
freq x:xs = [(x,y)| (x,y) x <- count , y <- rmdups]
Upvotes: 1
Views: 167
Reputation: 129754
There are two syntax errors here — no parenthesis on the pattern, and wrongly placed (x,y)
inside the comprehension. It should be:
freq (x : xs) = [(x, y) | x <- count, y <- rmdups]
Upvotes: 6
Reputation: 69924
You have to put parenthesis in your pattern match
freq (x:xs) = {- ... -}
Upvotes: 1