lo
functional-go
Our great sponsors
lo | functional-go | |
---|---|---|
64 | 4 | |
15,097 | 179 | |
- | - | |
6.1 | 5.9 | |
10 days ago | 4 months ago | |
Go | Go | |
MIT License | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
lo
-
Go 1.22 Release Notes
> can't wait for some map/filter/find slice functions though
Till that day comes, you could use the "lo" library (inspired from lodash). It's my goto Swiss army knife for golang projects.
On the other hand, I advise you NOT to use this kind of library and write simple, fast go code most of the time, with the occasional generics helper. Why the hell would I clutter my code with, for example: https://github.com/samber/lo?tab=readme-ov-file#fromentries-...
- I wrote a for loop so you don't have to. Parallel Map, Filter, Reduce library
-
What is your recommendation for a package beyond std?
In particular, I'd like recommend samber/lo, this is a lodash generic tool for golang.
-
What 3rd-party libraries do you use often/all the time?
What are some 3rd-party libraries for Go that you use often/all the time? Instead of "just implement everything yourself", I would really like to get some tips. For instance, a few days ago I discovered https://github.com/samber/lo , which looks very good if I want to have list comprehensions (Python) / LINQ methods (C#). https://pkg.go.dev/github.com/atotto/clipboard is also good for clipboard operations. What else do you suggest and for what task?
- Fourteen Years of Go
-
Functional Programming Library for Golang by IBM
A simple alternative is the combination of:
- https://github.com/samber/lo
- https://github.com/samber/mo
The split is also nice as you can choose to just use the generic convenience functions from lo without the more FP related things from mo.
- Khan Academy's switch from a Python 2 monolith to a services-oriented backend written in Go.
-
In what ways are channels are better than the traditional await?
Some packages offer utilities to gather results from goroutines, such as multierror.Group or parallel.Map in samber/lo.
-
samber/lo utility package based on generics
I came across samber/log a package based on generics for providing utility methods.
functional-go
-
Go 1.18 Released
>> By introducing a single generic, you could reduce it from 500 lines to 20
No one is writing 500 lines of code - just as when you use the generics syntax you don’t write the code that is generated by the compiler in response.
You could save about 10 lines, specifically these 10:
https://github.com/logic-building/functional-go/blob/master/...
You would still need the comparable ~40 lines of “generic” code:
https://github.com/logic-building/functional-go/blob/master/...
earlv 17th century
>> instead of actually giving a shit about the perspectives of those who disagree with you
Now i resent that because i took the time to try and steelman your bad argument.
>> they couldn't be without copy/pasting their implementation for every single array type you wanted to implement them for
Not true, as i said there’s always been options for this:
>> if we need them to be generic over argument types - in the absolute worst case (so not using go generate to help us here or an interface…
Behind the scenes in the compiler, the syntactic sugar of generics are ultimately performing what you would do with “go generate“.
>> in every project that wants to use them
I don’t follow, why aren’t we allowed to create a library for code reuse like https://github.com/logic-building/functional-go/blob/master/... has done for example?
What are some alternatives?
underscore - 🌟 Useful functional programming helpers for Go
mo - 🦄 Monads and popular FP abstractions, powered by Go 1.18+ Generics (Option, Result, Either...)
go-godash - An experimental generic functional utility library inspired by Lodash
fp-go - fp-go is a collection of Functional Programming helpers powered by Golang 1.18+ generics.
fpGo - Monad, Functional Programming features for Golang
go-generic-optional - Implementation of Optionals in Go using Generics
pie - 🍕 Enjoy a slice! A utility library for dealing with slices and maps that focuses on type safety and performance.
gofp - A super simple Lodash like utility library with essential functions that empowers the development in Go
goterators - A utility library that supports aggregate & transforms functions Go with generic. Such as filter, map, reduce, find, exist
fuego - Functional Experiment in Golang
slicesol
valor - Go option and result types that optionally contain a value