4 ms·
That sure is a lot of code given Haskell's concise reputation. I don't know Haskell. Would you mind explaining all what all the logic is doing?
by j2d2 17y ago
That sure is a lot of code given Haskell's concise reputation. I don't know Haskell. Would you mind explaining all what all the logic is doing?
- vito 17y agoI don't think it's too much code. Sudoku solving is nontrivial, and this is a complete application consisting of all of the IO handling, pretty printing, tests, guessing, etc. The actual solving is roughly 2/3rds of this source. Haskell is consise in the sense that you can accomplish a lot with small definitions - as you'll note, many of those functions are one-liners and exist solely to give meaning/value to something that is otherwise unclear. Even if the definition is used only once (or never used at all), it's well worth doing just for clarity and reusability's sake. That being said, there are a few warts in there - basically anything to do with the "boxes" I had to do a lot of repetitive ugly lines. I could probably have changed the structure of the grid to denote boxes, but this was a learning experience. (edit: re: the logic and everything, it's all explained at the bottom of the readme though I'd be happy to expound upon it)