Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rushsteve1/fp
Functional Programming tools in Go
https://github.com/rushsteve1/fp
Last synced: 24 days ago
JSON representation
Functional Programming tools in Go
- Host: GitHub
- URL: https://github.com/rushsteve1/fp
- Owner: rushsteve1
- License: apache-2.0
- Created: 2024-11-04T01:28:42.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-11-06T20:18:07.000Z (3 months ago)
- Last Synced: 2024-11-17T05:39:59.539Z (2 months ago)
- Language: Go
- Size: 54.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go Functional Programming
This library is cursed and you probably shouldn't use it.
It relies on the Dark Arts to enable a very non-idoimatic way of writing Go.I was inspired by @fossker's wonderful talk at Doomconf 2022H2 and his
[Common Lisp Transducers](https://codeberg.org/fosskers/cl-transducers)
package and documentation.But this is a different approach that aims to build upon Go's existing standard
library to introduce transducers in a simple way alongside a lot of other
FP features that I've wanted across various projectsThe end result is the ability to write Go code that looks like this
```go
Transduce(
Integers(),
Chain4(
Curry2(Take[int], 5),
Delta,
Curry2(Map, func(i int) []byte {
return []byte(strconv.Itoa(i))
}),
Visitor(Curry2(Write, io.Writer(&buf))),
),
Collect,
)
```None of the ideas in this library are new.
I'm mostly copying features from the wonderful [Clojure](https://clojure.org).