Skip to content

Commit

Permalink
CLJ-2649 Fix order of checks in some-fn and every-pred for 3 predicat…
Browse files Browse the repository at this point in the history
…e case to match other unrollings

Signed-off-by: Alex Miller <alex.miller@cognitect.com>
  • Loading branch information
puredanger committed Sep 14, 2021
1 parent 736c7a0 commit 42d7139
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/clj/clojure/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7461,8 +7461,8 @@ fails, attempts to require sym's namespace and retries."
(fn ep3
([] true)
([x] (boolean (and (p1 x) (p2 x) (p3 x))))
([x y] (boolean (and (p1 x) (p2 x) (p3 x) (p1 y) (p2 y) (p3 y))))
([x y z] (boolean (and (p1 x) (p2 x) (p3 x) (p1 y) (p2 y) (p3 y) (p1 z) (p2 z) (p3 z))))
([x y] (boolean (and (p1 x) (p1 y) (p2 x) (p2 y) (p3 x) (p3 y))))
([x y z] (boolean (and (p1 x) (p1 y) (p1 z) (p2 x) (p2 y) (p2 z) (p3 x) (p3 y) (p3 z))))
([x y z & args] (boolean (and (ep3 x y z)
(every? #(and (p1 %) (p2 %) (p3 %)) args))))))
([p1 p2 p3 & ps]
Expand Down Expand Up @@ -7501,8 +7501,8 @@ fails, attempts to require sym's namespace and retries."
(fn sp3
([] nil)
([x] (or (p1 x) (p2 x) (p3 x)))
([x y] (or (p1 x) (p2 x) (p3 x) (p1 y) (p2 y) (p3 y)))
([x y z] (or (p1 x) (p2 x) (p3 x) (p1 y) (p2 y) (p3 y) (p1 z) (p2 z) (p3 z)))
([x y] (or (p1 x) (p1 y) (p2 x) (p2 y) (p3 x) (p3 y)))
([x y z] (or (p1 x) (p1 y) (p1 z) (p2 x) (p2 y) (p2 z) (p3 x) (p3 y) (p3 z)))
([x y z & args] (or (sp3 x y z)
(some #(or (p1 %) (p2 %) (p3 %)) args)))))
([p1 p2 p3 & ps]
Expand Down
2 changes: 2 additions & 0 deletions test/clojure/test_clojure/other_functions.clj
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,9 @@
((some-fn number? odd? #(> % 0)) 2 4 6 8 -10)
;; 3 preds, short-circuiting
((some-fn number? odd? #(> % 0)) 1 :a)
((some-fn number? odd? #(> % 0)) :a 1)
((some-fn number? odd? #(> % 0)) 1 3 :a)
((some-fn number? odd? #(> % 0)) :a 1 3)
((some-fn number? odd? #(> % 0)) 1 3 5 :a)
((some-fn number? odd? #(> % 0)) 1 :a 3 5 7)
;; 4 preds
Expand Down

0 comments on commit 42d7139

Please sign in to comment.