Knight's tour: Difference between revisions
Content added Content deleted
(→{{header|Haskell}}: Tidied.) |
|||
Line 4,116: | Line 4,116: | ||
knightMoves :: [(Int, Int)] |
knightMoves :: [(Int, Int)] |
||
knightMoves = |
knightMoves = |
||
((>>=) <*> (\deltas n -> deltas >>= go n)) |
|||
[1, 2, -1, -2] |
|||
where |
where |
||
deltas = [id, negate] <*> [1, 2] |
|||
go i x |
go i x |
||
| abs i /= abs x = [(i, x)] |
| abs i /= abs x = [(i, x)] |