Pipes was an interesting attempt at a next-gen Series. The main weakness of Series is that it’s based on a pile of macros that try to recognize common patterns and fuse them, but that means that seemingly minor changes can take your code outside of the space of patterns it recognizes. This is because isn’t designed and documented as a proper embedded DSL, but instead tries to give the illusion that it supports arbitrary Common Lisp code… up until the point that you use something it doesn’t know about. Alas, Pipes never really got beyond an initial prototype.
I believe the current state of the art is the work described in Oleg Kiselyov et al., “Stream Fusion, to Completeness”, published at POPL 2017. https://arxiv.org/abs/1612.06668. That approach comes with example implementations in OCaml and Scala: https://strymonas.github.io/
Wow, that Stream Fusion paper looks interesting! Thanks for sharing.
How does this compare this with Clojure’s reducers/transducers? If we want to implement this in an arbitrary language, say Raku, what would be needed? Some kind of templating/macro system?
I understand Rust’s iterators support some form of stream fusion. Not sure if that’s similar to what’s described in the paper.
It was a great blog. Now there are more Series examples alongside their loop and iterate equivalents in the Cookbook: https://lispcookbook.github.io/cl-cookbook/iteration.html