removed channel dependency

This commit is contained in:
Timon Ringwald 2022-08-28 15:03:40 +02:00
parent 2124bff9de
commit 4f3cf3f537
2 changed files with 1 additions and 15 deletions

4
go.mod
View File

@ -1,5 +1,3 @@
module git.milar.in/milarin/slices module git.milar.in/milarin/slices
go 1.19 go 1.19
require git.milar.in/milarin/channel v0.0.7

View File

@ -1,9 +1,5 @@
package slices package slices
import (
"git.milar.in/milarin/channel"
)
func IndexOf[T comparable](slice []T, value T) int { func IndexOf[T comparable](slice []T, value T) int {
return IndexOfCmp(slice, value, DefaultEqualityComparator[T]) return IndexOfCmp(slice, value, DefaultEqualityComparator[T])
} }
@ -33,14 +29,6 @@ func Map[I, O any](slice []I, mapper func(I) O) []O {
return ret return ret
} }
func MapParallel[I, O any](slice []I, mapper func(I) O) []O {
return channel.ToSlice(channel.Map(channel.Of(slice...), mapper))
}
func MapParallelWithRunner[I, O any](slice []I, runner channel.Runner, mapper func(I) O) []O {
return channel.ToSlice(channel.MapWithRunner(channel.Of(slice...), runner, mapper))
}
func Each[T any](slice []T, f func(T)) { func Each[T any](slice []T, f func(T)) {
EachIndex(slice, func(_ int, v T) { f(v) }) EachIndex(slice, func(_ int, v T) { f(v) })
} }