https://github.com/mkeeler/go-immutable
Immutable Operations on Go types
https://github.com/mkeeler/go-immutable
Last synced: 3 months ago
JSON representation
Immutable Operations on Go types
- Host: GitHub
- URL: https://github.com/mkeeler/go-immutable
- Owner: mkeeler
- License: mpl-2.0
- Created: 2024-02-26T16:18:35.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-27T15:42:12.000Z (over 1 year ago)
- Last Synced: 2025-02-07T14:45:31.512Z (5 months ago)
- Language: Go
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-immutable
[](https://github.com/mkeeler/go-immutable/actions/workflows/go.yml) [](https://goreportcard.com/report/github.com/mkeeler/go-immutable) [](https://pkg.go.dev/github.com/mkeeler/go-immutable)This library contains functions to operate on Go types in a generic and immutable way. Most of the overall behavior exists in the standard library as mutating functions already and you should really only use this library if you specifically require the immutability guarantees.
See it in action:
```go
package fooimport (
"slices"
"github.com/mkeeler/go-immutable/immutableslice"
)func FindAndRemove(s []int, v int) []int {
idx := slices.Index(s, v)
return immutableslice.Delete(s, idx, idx+1)
}
```