Browse files

Side-narrowing: why didn't I thought of it before?

  • Loading branch information...
1 parent 2e80292 commit aa7c7ca4b55554ee6562ab139bdc69b9e516f62c @cgrand cgrand committed Apr 11, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/main/clojure/clojure/core/logic.clj
@@ -809,7 +809,9 @@
(defn join
"Returns the intersection of two Searches"
[a b]
- (and a b (Join. a b (+ (sizehint a) (sizehint b)))))
+ ; if a or b is nil then the narrowed a will be nil
+ (when-let [a (narrow a (min-yield b))]
+ (Join. a b (+ (sizehint a) (sizehint b)))))
(deftype Narrow [a ss]

0 comments on commit aa7c7ca

Please sign in to comment.