Created
March 11, 2015 12:01
-
-
Save iseebi/b0b0250b4e5f29d4bde2 to your computer and use it in GitHub Desktop.
すごいHaskell読書会 in 大阪 2周目 #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Pos = (Int, Int) | |
checkCol :: Pos -> [Pos] -> Bool | |
checkCol (row, col) l = not . elem True $ map (\(_, col') -> col' == col) l | |
putFu :: Pos -> [Pos] -> Maybe [Pos] | |
putFu (row, col) l | |
| row < 1 = Nothing | |
| row > 8 = Nothing | |
| col < 1 = Nothing | |
| col > 9 = Nothing | |
| checkCol (row, col) l == False = Nothing | |
| otherwise = Just $ (row, col):l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment