File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -469,15 +469,19 @@ public APersistentVector.Seq withMeta(IPersistentMap meta){
469469
470470 public Object reduce (IFn f ) {
471471 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+ }
474476 return ret ;
475477 }
476478
477479 public Object reduce (IFn f , Object start ) {
478480 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+ }
481485 return ret ;
482486 }
483487 }
Original file line number Diff line number Diff line change @@ -113,15 +113,19 @@ public PersistentList withMeta(IPersistentMap meta){
113113
114114public Object reduce (IFn f ) {
115115 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+ }
118120 return ret ;
119121}
120122
121123public Object reduce (IFn f , Object start ) {
122124 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+ }
125129 return ret ;
126130}
127131
You can’t perform that action at this time.
0 commit comments