Skip to content

Add trait with type to foldLeft def #1778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 19, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion _tour/multiple-parameter-lists.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ Methods may have multiple parameter lists.
Here is an example, as defined on the `TraversableOnce` trait in Scala's collections API:

```
def foldLeft[B](z: B)(op: (B, A) => B): B
trait TraversableOnce[A] {
...
def foldLeft[B](z: B)(op: (B, A) => B): B
...
}
```

`foldLeft` applies a two-parameter function `op` to an initial value `z` and all elements of this collection, going left to right. Shown below is an example of its usage.
Expand Down