Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mkeeler/go-immutable
Immutable Operations on Go types
https://github.com/mkeeler/go-immutable
Last synced: 19 days 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 (9 months ago)
- Default Branch: main
- Last Pushed: 2024-02-27T15:42:12.000Z (9 months ago)
- Last Synced: 2024-10-13T01:08:49.817Z (about 1 month 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
[![Build Status](https://github.com/mkeeler/go-immutable/actions/workflows/go.yml/badge.svg?branch=main)](https://github.com/mkeeler/go-immutable/actions/workflows/go.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/mkeeler/go-immutable)](https://goreportcard.com/report/github.com/mkeeler/go-immutable) [![PkgGoDev](https://pkg.go.dev/badge/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)
}
```