3 ms·
Even if it's not the only way to implement iterators, using closures which maintain state and yield values one after another seems to be a very popular way to d
by rectang 6y ago
Even if it's not the only way to implement iterators, using closures which maintain state and yield values one after another seems to be a very popular way to do it.
In that case you're passing around a function, which matches how this chapter characterizes "functional programming".