Menu

Post image 1
Post image 2
Post image 3
1 / 3
0

iter.Seq in Go 1.23+: The Iterator Type Behind range-over-func

DEV Community·Gabriel Anhaia·27 days ago
#nycoDpuS
#go#programming#backend#tutorial#iter#func
Reading 0:00
15s threshold

Book: The Complete Guide to Go Programming Also by me: Thinking in Go (2-book series) — Complete Guide to Go Programming + Hexagonal Architecture in Go My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools Me: xgabriel.com | GitHub Range-over-func is the language feature everyone wrote about in Go 1.23. iter.Seq[V] is the type your code is supposed to pass around. The standard library quietly grew an ecosystem to feed it, drain it, sort it, and chunk it. The whole iter package fits on one screen — two type aliases and two helpers : package iter type Seq [ V any ] func ( yield func ( V ) bool ) type Seq2 [ K , V any ] func ( yield func ( K , V ) bool ) func Pull [ V any ]( seq Seq [ V ]) ( next func () ( V , bool ), stop func ()) func Pull2 [ K , V any ]( seq Seq2 [ K , V ]) ( next func () ( K , V , bool ), stop func ()) Enter fullscreen mode Exit fullscreen mode Two type aliases for callback-shaped functions and two helpers that flip from push to pull.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More