mirror of
https://github.com/dlang/phobos.git
synced 2025-05-10 05:41:56 +03:00
Merge pull request #5227 from wilzbach/fold-walkBack
walkBack follow-up: Mention fold's potential in the examples
This commit is contained in:
commit
7bd4c60c0c
1 changed files with 3 additions and 0 deletions
|
@ -3206,6 +3206,9 @@ if (fun.length >= 1)
|
|||
|
||||
// Can be used in a UFCS chain
|
||||
assert(arr.map!(a => a + 1).fold!((a, b) => a + b) == 20);
|
||||
|
||||
// Return the last element of any range
|
||||
assert(arr.fold!((a, b) => b) == 5);
|
||||
}
|
||||
|
||||
@safe @nogc pure nothrow unittest
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue