How do you detect if a list has exactly 3 items in Haskell?

Posted by kunjaan on Stack Overflow See other posts from Stack Overflow or by kunjaan
Published on 2010-03-19T21:05:55Z Indexed on 2010/03/19 21:11 UTC
Read the original article Hit count: 111

Filed under:

I have this but I got an error:

-- test if a list containts exactly three characters
test :: [Char] -> Bool
test xs   | [_ , _ , _] = True
          | otherwise = False

© Stack Overflow or respective owner

Related posts about haskell