File tree 2 files changed +16
-8
lines changed
2 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -469,15 +469,19 @@ public APersistentVector.Seq withMeta(IPersistentMap meta){
469
469
470
470
public Object reduce (IFn f ) {
471
471
Object ret = v .nth (i );
472
- for (int x = i + 1 ; x < v .count (); x ++)
473
- ret = f .invoke (ret , v .nth (x ));
472
+ for (int x = i + 1 ; x < v .count (); x ++) {
473
+ ret = f .invoke (ret , v .nth (x ));
474
+ if (RT .isReduced (ret )) return ((IDeref )ret ).deref ();
475
+ }
474
476
return ret ;
475
477
}
476
478
477
479
public Object reduce (IFn f , Object start ) {
478
480
Object ret = f .invoke (start , v .nth (i ));
479
- for (int x = i + 1 ; x < v .count (); x ++)
480
- ret = f .invoke (ret , v .nth (x ));
481
+ for (int x = i + 1 ; x < v .count (); x ++) {
482
+ if (RT .isReduced (ret )) return ((IDeref )ret ).deref ();
483
+ ret = f .invoke (ret , v .nth (x ));
484
+ }
481
485
return ret ;
482
486
}
483
487
}
Original file line number Diff line number Diff line change @@ -113,15 +113,19 @@ public PersistentList withMeta(IPersistentMap meta){
113
113
114
114
public Object reduce (IFn f ) {
115
115
Object ret = first ();
116
- for (ISeq s = next (); s != null ; s = s .next ())
117
- ret = f .invoke (ret , s .first ());
116
+ for (ISeq s = next (); s != null ; s = s .next ()) {
117
+ ret = f .invoke (ret , s .first ());
118
+ if (RT .isReduced (ret )) return ((IDeref )ret ).deref ();;
119
+ }
118
120
return ret ;
119
121
}
120
122
121
123
public Object reduce (IFn f , Object start ) {
122
124
Object ret = f .invoke (start , first ());
123
- for (ISeq s = next (); s != null ; s = s .next ())
124
- ret = f .invoke (ret , s .first ());
125
+ for (ISeq s = next (); s != null ; s = s .next ()) {
126
+ if (RT .isReduced (ret )) return ((IDeref )ret ).deref ();
127
+ ret = f .invoke (ret , s .first ());
128
+ }
125
129
return ret ;
126
130
}
127
131
You can’t perform that action at this time.
0 commit comments