iter
Package iter provides generic, lazy iterators, functions for producing them from primitive types, as well as functions and methods for transforming and consuming them. (by mtoohey31)
go-iterator
Go 1.18 generics iterator experiment (by polyfloyd)
Our great sponsors
- SonarLint - Clean code begins in your IDE with SonarLint
- ONLYOFFICE ONLYOFFICE Docs — document collaboration in your environment
- InfluxDB - Access the most powerful time series database as a service
iter | go-iterator | |
---|---|---|
2 | 2 | |
30 | 4 | |
- | - | |
5.1 | 0.0 | |
about 1 month ago | 8 months ago | |
Go | Go | |
BSD 3-clause "New" or "Revised" License | - |
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
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.
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.
iter
Posts with mentions or reviews of iter.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2022-01-10.
-
iter: Generic, lazy iterators for Go 1.18
I've been working on an iterator package for Go 1.18. Here's a quick snippet:
The reason why I decided on the inner/outer architecture was because interface objects can't be used as recievers to methods (as far as I understand). As a result, my initial implementation, which didn't have this structure, was limited to functions instead of methods, which made code where iterator methods were chained extremely unreadable, since it was difficult to tell which order they were being applied in. It's a tradeoff, but I think the readability might be worth it. Do you have any ideas for alternative workarounds?
go-iterator
Posts with mentions or reviews of go-iterator.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2022-03-15.
-
1.18 is released
I already played around a bit wit the beta a while back and made an iterator library to get to know this new language. It's here for anyone interested: https://github.com/polyfloyd/go-iterator
-
iter: Generic, lazy iterators for Go 1.18
Regarding call chaining, it is still possible to chain things with operations that return different types, but they have to be done with functions instead of methods, so the result is still the same, just it's a little less readable. There is a generic iterator implementation by polyfloyd that doesn't support method chaining, but imo being able to chain iterators is one of their biggest strengths, since implementing lazy evaluation manually for a single operation isn't that difficult, its when you need to perform multiple kinds of manipulations that it gets messy.
What are some alternatives?
When comparing iter and go-iterator you can also consider the following projects:
gtools - Generic tools for go 1.18+
lo - 💥 A Lodash-style Go library based on Go 1.18+ Generics (map, filter, contains, find...)