Skip to content

Commit

Permalink
mr: add flats function
Browse files Browse the repository at this point in the history
  • Loading branch information
ImSingee committed Jul 25, 2023
1 parent 65a29be commit ca9ed1a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mr/flat.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ func Flat[T any](arr [][]T) []T {
return append(acc, in...)
}, nil)
}

func Flats[T any](arr ...[]T) []T {
return Reduce(arr, func(acc []T, in []T, index int) []T {
return append(acc, in...)
}, nil)
}

0 comments on commit ca9ed1a

Please sign in to comment.