Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defmacro pruning-sudoku [board out]
- (let [lvars (repeatedly 81 gensym)
- [vrows vcols vblocks] (slice lvars)
- [rows cols blocks] (slice (reduceable-board board))]
- (concat
- `(exist [~@lvars]
- (== ~out (list ~@lvars)))
- (interleave
- (map (fn [vrow row]
- `(prune-o (list ~@row) (list ~@vrow)))
- vrows rows)
- (map (fn [vcol col]
- `(prune-o (list ~@col) (list ~@vcol)))
- vcols cols)
- (map (fn [vblock block]
- `(prune-o (list ~@block) (list ~@vblock)))
- vblocks blocks)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement