Skip to content

The missing map/filter/reduce (+more) for golang.org/x/exp/slices (requires Go v1.18+)

License

Notifications You must be signed in to change notification settings

felix-kaestner/slices

Repository files navigation

Slices

The missing map/filter/reduce (+more) for golang.org/x/exp/slices (requires Go v1.18+).

Issues Stars License Stars Issues Twitter

Quickstart

package main

import (
    "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 and Pull Request templates and I'll be happy to review your suggestions. 👍


Released under the MIT License.

About

The missing map/filter/reduce (+more) for golang.org/x/exp/slices (requires Go v1.18+)

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project