You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/scala/stdlib/Traversables.scala
+10-26Lines changed: 10 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -424,54 +424,38 @@ object Traversables extends FlatSpec with Matchers with org.scalaexercises.defin
424
424
result should be(res0)
425
425
}
426
426
427
-
/** `/:` or `foldLeft` will combine an operation starting with a seed and combining from the left. `foldLeft` is defined as (seed /: list), where seed is the initial value. Once the fold is established, you provide a function that takes two arguments. The first argument is the running total of the operation, and the second element is the next element of the list.
427
+
/** `foldLeft` will combine an operation starting with a seed and combining from the left. `foldLeft` takes as a first parameter the initial value of the fold. Once the fold is established, you provide a function that takes two arguments. The first argument is the running total of the operation, and the second element is the next element of the list.
428
428
*
429
429
* Given a `Traversable (x1, x2, x3, x4)`, an initial value of `init`, an operation `op`, `foldLeft` is defined as: `(((init op x1) op x2) op x3) op x4)`
/** `:\` or `foldRight` will combine an operation starting with a seed and combining from the right. Fold right is defined as (list :\ seed), where seed is the initial value. Once the fold is established, you provide a function that takes two elements. The first is the next element of the list, and the second element is the running total of the operation.
444
+
/** `foldRight` will combine an operation starting with a seed and combining from the right. `foldRight` takes as a first parameter the initial value of the fold. Once the fold is established, you provide a function that takes two elements. The first is the next element of the list, and the second element is the running total of the operation.
453
445
*
454
446
* Given a `Traversable (x1, x2, x3, x4)`, an initial value of `init`, an operation `op`, `foldRight` is defined as: `x1 op (x2 op (x3 op (x4 op init)))`
0 commit comments