https://github.com/mdb/funcy
A minimal Go package providing a few functional utilities.
https://github.com/mdb/funcy
functional-programming go golang
Last synced: 9 months ago
JSON representation
A minimal Go package providing a few functional utilities.
- Host: GitHub
- URL: https://github.com/mdb/funcy
- Owner: mdb
- License: mit
- Created: 2022-12-16T17:45:30.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-17T15:06:06.000Z (almost 3 years ago)
- Last Synced: 2025-01-14T16:36:17.280Z (10 months ago)
- Topics: functional-programming, go, golang
- Language: Go
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/mdb/funcy/actions/workflows/ci.yaml) [](https://pkg.go.dev/github.com/mdb/funcy) [](https://goreportcard.com/report/github.com/mdb/funcy)
# funcy ("funky")
A minimal Go package providing a few functional utilities using Go [generics](https://go.dev/blog/intro-generics).
Nothin' too special; largely just for my own learning and casual use, but perhaps this useful to you too.
## Test
```
make
```
## API
[](https://pkg.go.dev/github.com/mdb/funcy)
Summary:
```
package funcy // import "github.com/mdb/funcy"
var ErrNotFound = errors.New("not found")
func Any[E any](s []E, f evaluator[E]) bool
func Contains[E comparable](s []E, v E) bool
func Dedupe[E comparable](s []E) []E
func Filter[E any](s []E, f retainer[E]) []E
func Find[E any](s []E, f finder[E]) (E, error)
func Map[E any](s []E, f mapper[E]) []E
func Quicksort[E constraints.Ordered](arr []E) []E
func Reduce[E any](s []E, init E, f reducer[E]) E
func ReduceRight[E any](s []E, init E, f reducer[E]) E
func Reverse[E any](s []E) []E
func Sort[E constraints.Ordered](s []E) []E
```