Represent each cell as a row number, column number, and a set of possible digits that can go in that cell. Create a map that generates a keyword for the sector name from the row and column numbers. You're going to write a recursive function that processes a sequence of cells that still need to be analyzed, but this sequence is not maintained in grid order. Instead you keep them sorted by the number of possibilities for that cell. Do a backtracking search, starting with the cell with the fewest possibilities. When you assign a number to a cell, you remove that number from the possibilities in the other cells sharing the same row/column/sector. If you ever have an empty possibility list for a cell at the front of your still-to-analyze sequence, then you need to backtrack.
The beauty is that with Clojure's non-destructive data structures, the backtracking is so elegant and easy to code, just using recursion. It's so much messier in Python. If you don't know how to do backtracking in functional programming languages, check out How To Design Programs: http://htdp.org/2003-09-26/Book/curriculum-Z-H-35.html#node_chap_28 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---