Advertisement
Guest User

Untitled

a guest
Mar 16th, 2011
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (defmacro pruning-sudoku [board out]
  2.   (let [lvars (repeatedly 81 gensym)
  3.         [vrows vcols vblocks] (slice lvars)
  4.         [rows cols blocks] (slice (reduceable-board board))]
  5.     (concat
  6.       `(exist [~@lvars]
  7.               (== ~out (list ~@lvars)))
  8.       (interleave
  9.         (map (fn [vrow row]
  10.                `(prune-o (list ~@row) (list ~@vrow)))
  11.              vrows rows)
  12.         (map (fn [vcol col]
  13.                `(prune-o (list ~@col) (list ~@vcol)))
  14.              vcols cols)
  15.         (map (fn [vblock block]
  16.                `(prune-o (list ~@block) (list ~@vblock)))
  17.              vblocks blocks)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement