Skip to content

Commit

Permalink
docs: Update FoldLeft and FoldRight.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Sep 20, 2020
1 parent 317483e commit 98ced08
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/pages/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -654,13 +654,23 @@ This example will return ``['a', 'b', 'c', 'd', 'a']``.
foldLeft
~~~~~~~~

Takes the initial value and the first item of the list and applies the function to them, then feeds the function with
this result and the second argument and so on. See `scanLeft` for intermediate results.

Interface: `FoldLeftable`_

Signature: ``Collection::foldLeft(callable $callback, $initial = null);``

foldRight
~~~~~~~~~

Takes the initial value and the last item of the list and applies the function, then it takes the penultimate item from
the end and the result, and so on. See `scanRight` for intermediate results.

Interface: `FoldRightable`_

Signature: ``Collection::foldRight(callable $callback, $initial = null);``

forget
~~~~~~

Expand Down

0 comments on commit 98ced08

Please sign in to comment.