Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/felix-kaestner/slices
The missing map/filter/reduce (+more) for golang.org/x/exp/slices (requires Go v1.18+)
https://github.com/felix-kaestner/slices
generics go golang slices
Last synced: about 5 hours ago
JSON representation
The missing map/filter/reduce (+more) for golang.org/x/exp/slices (requires Go v1.18+)
- Host: GitHub
- URL: https://github.com/felix-kaestner/slices
- Owner: felix-kaestner
- License: mit
- Created: 2022-08-21T12:38:41.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-10T00:47:42.000Z (5 months ago)
- Last Synced: 2024-06-20T15:58:04.957Z (5 months ago)
- Topics: generics, go, golang, slices
- Language: Go
- Homepage:
- Size: 43.9 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Slices
The missing map/filter/reduce (+more) for golang.org/x/exp/slices (requires Go v1.18+).
## Quickstart
```go
package mainimport (
"fmt""github.com/felix-kaestner/slices"
)func main() {
// Original slice of integers
numbers := []int{1, 2, 3, 4, 5}
// Filter only numbers greater than 2
greaterThanTwo := slices.Filter(s1, func(i int) bool { return i > 2 })
fmt.Println("Numbers > 2:", greaterThanTwo)
// Prints "Numbers > 2: []int{3, 4, 5}"
}
```## Installation
Install with the `go get` command:
```
$ go get -u github.com/felix-kaestner/slices
```## Contribute
All contributions in any form are welcome! 🙌🏻
Just use the [Issue](.github/ISSUE_TEMPLATE) and [Pull Request](.github/PULL_REQUEST_TEMPLATE) templates and I'll be happy to review your suggestions. 👍---
Released under the [MIT License](LICENSE).