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

builtin: deprecate array.reduce in favour of arrays.fold (#16001)

This commit is contained in:
ChAoS_UnItY
2022-10-09 15:29:50 +08:00
committed by GitHub
parent fe6197fe2d
commit 95f57e9206
2 changed files with 10 additions and 7 deletions

View File

@ -898,7 +898,9 @@ pub fn copy(mut dst []u8, src []u8) 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.
// See also `arrays.fold`.
// See also `arrays.reduce` for same name or `arrays.fold` for same functionality.
[deprecated: 'use arrays.fold instead, this function has less flexibility than arrays.fold']
[deprecated_after: '2022-10-11']
pub fn (a []int) reduce(iter fn (int, int) int, accum_start int) int {
mut accum_ := accum_start
for i in a {