We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent af5f4d1 commit 00cf7f6Copy full SHA for 00cf7f6
compiler/src/dotty/tools/dotc/core/Decorators.scala
@@ -112,9 +112,11 @@ object Decorators {
112
else x1 :: xs1
113
}
114
115
- def foldRightBN[U](z: => U)(op: (T, => U) => U): U = xs match {
+ def foldRightBN[U](z: => U)(op: (T, => U) => U): U = xs.reverse.foldLeftBN(z)(op)
116
+
117
+ @tailrec final def foldLeftBN[U](z: => U)(op: (T, => U) => U): U = xs match {
118
case Nil => z
- case x :: xs1 => op(x, xs1.foldRightBN(z)(op))
119
+ case x :: xs1 => xs1.foldLeftBN(op(x, z))(op)
120
121
122
final def hasSameLengthAs[U](ys: List[U]): Boolean = {
0 commit comments