Skip to content

Instantly share code, notes, and snippets.

@jdiez17
Created May 28, 2014 20:40
Show Gist options
  • Save jdiez17/d0c6f50a5e8dbde4d740 to your computer and use it in GitHub Desktop.
Save jdiez17/d0c6f50a5e8dbde4d740 to your computer and use it in GitHub Desktop.
itemsInSquare :: Sudoku -> Position -> [Digit]
itemsInSquare (Sudoku rows) (Position x y) = [y'..y'+2] >>= (\idx -> take 3 $ drop x' $ rows !! idx)
where x' = x - x `mod` 3
y' = y - y `mod` 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment