Advertisement
Guest User

Untitled

a guest
Jun 9th, 2019
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. a = [[White,White,Black],[White,Black,White]]
  2. board = [[[White,Black],[White,Black],[Black]],[[White,Black],[Black],[Black]]]
  3.  
  4. doesBoardMatch a board
  5.  
  6. doesBoardMatch :: [[Color]] -> [[[Color]]] -> Bool
  7. doesBoardMatch [] _ = True
  8. doesBoardMatch (x:xs) (y:ys)  | (doesRowMatch x y) == False = False
  9.                               |otherwise = doesBoardMatch xs ys
  10.  
  11. doesRowMatch :: [Color] -> [[Color]] -> Bool
  12. doesRowMatch [] _ = True
  13. doesRowMatch (x:xs) (y:ys)  | (isInArr x y) == False = False
  14.                             |otherwise = doesRowMatch xs ys
  15.  
  16.  
  17.  
  18. isInArr :: Eq t => t -> [t] -> Bool
  19. inInArr t [] = False
  20. isInArr t (x:xs)  | t==x = True
  21.                   | otherwise = isInArr t xs
  22.  
  23.  
  24. SPOP: SPOP.hs:(147,1)-(148,44): Non-exhaustive patterns in function isInArr
  25.  
  26. wywala sie jak powinno zwrócić false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement