You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -153,8 +152,8 @@ list = gs.Filter([]int{1, 2, 3, 4, 5, 6, 7, 8}, func(t, i int) bool {
153
152
Calls the specified callback function for all the elements in a slice. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
154
153
155
154
```go
156
-
sum:= gs.Reduce([]int{1, 2, 3}, func(rint, tint, iint) int {
157
-
returnr + t
155
+
sum:= gs.Reduce([]int{1, 2, 3}, func(previousValueint, currentValueint, currentIndexint) int {
156
+
returnpreviousValue + currentValue
158
157
}, 0)
159
158
// 6
160
159
```
@@ -164,8 +163,8 @@ sum := gs.Reduce([]int{1, 2, 3}, func(r int, t int, i int) int {
164
163
Returns the index of the first element in the slice that satisfies the provided testing function. Otherwise, it returns -1
0 commit comments