Skip to content

Commit 2798b2c

Browse files
committed
Avoid unecessary currying in uncurried version of foldRight.
1 parent 52a49fd commit 2798b2c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/src/main/java/fj/data/List.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ public final List<A> append(final List<A> as) {
716716
* @return The final result after the right-fold reduction.
717717
*/
718718
public final <B> B foldRight(final F<A, F<B, B>> f, final B b) {
719-
return reverse().foldLeft(flip(f), b);
719+
return foldRight(uncurryF2(f), b);
720720
}
721721

722722
/**
@@ -727,7 +727,7 @@ public final <B> B foldRight(final F<A, F<B, B>> f, final B b) {
727727
* @return The final result after the right-fold reduction.
728728
*/
729729
public final <B> B foldRight(final F2<A, B, B> f, final B b) {
730-
return foldRight(curry(f), b);
730+
return reverse().foldLeft(flip(f), b);
731731
}
732732

733733
/**

0 commit comments

Comments
 (0)