fp-go
Fp-go is a collection of Functional Programming helpers powered by Golang 1.18+ generics.
Inspired by
Contents
Install
Requires go 1.18+
go get github.com/repeale/fp-go
Features
Currying
By default! Data last!
func isPositive(x int) bool {
return x > 0
}
func main() {
filterPositive := fp.Filter(isPositive)
numbers := []int{1, 2, 3, 4, 5}
positives := filterPositive(numbers)
}
Variations
Variations allows you to get different parameters in the callback function so that you get only only what is really needed.
Default
Only the current item is available:
fp.Map[int, string](func(x int) { ... })
WithIndex
Current…