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

sum types: allow modification in match

This commit is contained in:
Alexander Medvednikov
2020-02-03 09:11:10 +01:00
parent d918903252
commit 34e9eb32bb
5 changed files with 47 additions and 21 deletions

View File

@ -447,6 +447,7 @@ pub fn (a []char) index(v char) int {
return -1
}
/*
// []int.reduce executes a given reducer function on each element of the array,
// resulting in a single output value.
pub fn (a []int) reduce(iter fn(accum, curr int)int, accum_start int) int {
@ -457,6 +458,7 @@ pub fn (a []int) reduce(iter fn(accum, curr int)int, accum_start int) int {
}
return _accum
}
*/
// array_eq<T> checks if two arrays contain all the same elements in the same order.
// []int == []int (also for: i64, f32, f64, byte, string)