This is similar to how Clojure transducers are implemented: "give me the next thing plz." – https://clojure.org/reference/transducers