1
0
mirror of https://github.com/IBM/fp-go.git synced 2025-08-10 22:31:32 +02:00

fix: add a uniq method to arrays

Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
Dr. Carsten Leue
2023-11-30 09:02:38 +01:00
parent b6efa35b03
commit 3bf432af49
4 changed files with 65 additions and 2 deletions

View File

@@ -19,13 +19,13 @@ import (
G "github.com/IBM/fp-go/iterator/stateless/generic"
)
// StrictUniq converts an [Iterator] or arbitrary items into an [Iterator] or unique items
// StrictUniq converts an [Iterator] of arbitrary items into an [Iterator] or unique items
// where uniqueness is determined by the built-in uniqueness constraint
func StrictUniq[A comparable](as Iterator[A]) Iterator[A] {
return G.StrictUniq[Iterator[A]](as)
}
// Uniq converts an [Iterator] or arbitrary items into an [Iterator] or unique items
// Uniq converts an [Iterator] of arbitrary items into an [Iterator] or unique items
// where uniqueness is determined based on a key extractor function
func Uniq[A any, K comparable](f func(A) K) func(as Iterator[A]) Iterator[A] {
return G.Uniq[Iterator[A], K](f)