1
0
mirror of https://github.com/IBM/fp-go.git synced 2025-11-23 22:14:53 +02:00

fix: add inline annotations

Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
Dr. Carsten Leue
2025-11-06 10:54:24 +01:00
parent 56c8f1b034
commit 0d3a8634b1
22 changed files with 681 additions and 13 deletions

View File

@@ -15,6 +15,8 @@ import (
//
// strings := []string{"a", "b", "a", "c", "b"}
// unique2 := array.StrictUniq(strings) // ["a", "b", "c"]
//
//go:inline
func StrictUniq[A comparable](as []A) []A {
return G.StrictUniq[[]A](as)
}
@@ -42,6 +44,8 @@ func StrictUniq[A comparable](as []A) []A {
// uniqueByName := array.Uniq(func(p Person) string { return p.Name })
// result := uniqueByName(people)
// // Result: [{"Alice", 30}, {"Bob", 25}, {"Charlie", 30}]
//
//go:inline
func Uniq[A any, K comparable](f func(A) K) func(as []A) []A {
return G.Uniq[[]A](f)
}