Skip to content

Commit 4c963fb

Browse files
puredangerstuarthalloway
authored andcommitted
CLJ-1549 Split IReduce into IReduceInit
Signed-off-by: Stuart Halloway <stu@cognitect.com>
1 parent 695f03c commit 4c963fb

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

src/clj/clojure/core.clj

+3-3
Original file line numberDiff line numberDiff line change
@@ -6515,8 +6515,8 @@
65156515
([xform f coll] (transduce xform f (f) coll))
65166516
([xform f init coll]
65176517
(let [f (xform f)
6518-
ret (if (instance? clojure.lang.IReduce coll)
6519-
(.reduce ^clojure.lang.IReduce coll f init)
6518+
ret (if (instance? clojure.lang.IReduceInit coll)
6519+
(.reduce ^clojure.lang.IReduceInit coll f init)
65206520
(clojure.core.protocols/coll-reduce coll f init))]
65216521
(f ret))))
65226522

@@ -7264,7 +7264,7 @@
72647264
clojure.lang.Seqable
72657265
(seq [_] (seq (sequence xform coll)))
72667266

7267-
clojure.lang.IReduce
7267+
clojure.lang.IReduceInit
72687268
(reduce [_ f init] (transduce xform f init coll))
72697269

72707270
clojure.lang.Sequential)

src/jvm/clojure/lang/IReduce.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
package clojure.lang;
1414

15-
public interface IReduce{
15+
public interface IReduce extends IReduceInit{
1616
Object reduce(IFn f) ;
17-
18-
Object reduce(IFn f, Object start) ;
1917
}

src/jvm/clojure/lang/IReduceInit.java

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Copyright (c) Rich Hickey. All rights reserved.
3+
* The use and distribution terms for this software are covered by the
4+
* Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5+
* which can be found in the file epl-v10.html at the root of this distribution.
6+
* By using this software in any fashion, you are agreeing to be bound by
7+
* the terms of this license.
8+
* You must not remove this notice, or any other, from this software.
9+
**/
10+
11+
package clojure.lang;
12+
13+
public interface IReduceInit{
14+
Object reduce(IFn f, Object start) ;
15+
}

0 commit comments

Comments
 (0)