Skip to content

Commit

Permalink
* src/main/clojure/clojure/core/logic/bench.clj: fix nqueens
Browse files Browse the repository at this point in the history
  • Loading branch information
David Nolen authored and David Nolen committed Jul 10, 2012
1 parent ff793c0 commit b1681c4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main/clojure/clojure/core/logic/bench.clj
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@

(defne noattacko [q others]
([_ ()])
([[x y] [[x1 y1] . others]]
([[x y] [[x1 y1] . r]]
(!= y y1)
(project [y y1 x x1]
(!= (- y1 y) (- x1 x))
(!= (- y1 y) (- x x1)))
(noattacko [x y] others)))
(noattacko [x y] r)))

(defn solve-nqueens []
(run* [q]
Expand Down Expand Up @@ -155,8 +155,9 @@
;; ~610ms
(dotimes [_ 10]
(time
(dotimes [_ 1]
(solve-nqueens))))
(binding [*occurs-check* false]
(dotimes [_ 1]
(solve-nqueens)))))

;; nqueens benefits from constraints
)
Expand Down

0 comments on commit b1681c4

Please sign in to comment.