1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

arrays: improve fold/reduce docs (#13700)

This commit is contained in:
Nick Treleaven
2022-03-09 18:04:49 +00:00
committed by GitHub
parent 6c7243f2f7
commit 54de04a916
2 changed files with 17 additions and 6 deletions

View File

@@ -826,7 +826,8 @@ pub fn copy(dst []byte, src []byte) int {
// reduce executes a given reducer function on each element of the array,
// resulting in a single output value.
// NOTE: It exists as a method on `[]int` types only
// NOTE: It exists as a method on `[]int` types only.
// See also `arrays.fold`.
pub fn (a []int) reduce(iter fn (int, int) int, accum_start int) int {
mut accum_ := accum_start
for i in a {