Skip to content

Commit 2c96cef

Browse files
pinguo-lixinlixin
andauthored
feat: add array.MonadReduce() function (#132)
Signed-off-by: lixin <lixin@dustess.com> Co-authored-by: lixin <lixin@dustess.com>
1 parent 3385c70 commit 2c96cef

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

array/array.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ func reduceRef[A, B any](fa []A, f func(B, *A) B, initial B) B {
141141
return current
142142
}
143143

144+
func MonadReduce[A, B any](fa []A, f func(B, A) B, initial B) B {
145+
return G.MonadReduce(fa, f, initial)
146+
}
147+
144148
func Reduce[A, B any](f func(B, A) B, initial B) func([]A) B {
145149
return G.Reduce[[]A](f, initial)
146150
}

0 commit comments

Comments
 (0)