SHARE
TWEET

Untitled

a guest Mar 16th, 2011 81 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)))))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top