iter: Generic, lazy iterators for Go 1.18

This page summarizes the projects mentioned and recommended in the original post on /r/golang

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • 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)

  • 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

    The Go programming language

  • Also, can anyone explain the error "instantiation cycle" to me? I have two methods commented for which this was occuring: Position in iter.go, and ZipEndo in zip.go, and I'm not sure what this error means, or why it occurs, since the corresponding function implementation (Zip) of ZipEndo has no such problem. I don't believe it's an implementation bug in the tuple package, since I was originally using my own simple 2-value tuple struct and the exact same error ocurred. The only thing I can find about it online is this post, but I'm not sure how the answer there applies to either of my cases...

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • gtools

    Generic tools for go 1.18+

  • Looks good Do you benchmark it vs for loop? Recently I am wrote pretty similar lib but using functions for all(filter, ForEach etc): gtools Maybe you will find something for yours lib

  • go-iterator

    Discontinued Go 1.18 generics iterator experiment

  • 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.

  • go-generic

    A collection of experiments using Go Generics coming out in Go 1.18

  • I did some experimenting of my own and came up with this design: https://github.com/qualidafial/go-generic/tree/master/iter

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Abusing Go's Infrastructure

    3 projects | news.ycombinator.com | 25 May 2024
  • Proposal: Add "SIMD" package to standard library

    1 project | news.ycombinator.com | 20 May 2024
  • Golang is evil on shitty networks

    1 project | news.ycombinator.com | 19 May 2024
  • Generic Concurrency in Go

    2 projects | dev.to | 17 May 2024
  • Creating a personal AI assistant a.k.a An approachable series on learning new stuff!

    1 project | dev.to | 10 May 2024