9 ms·
How are iterators functional language features? They're not unique to functional languages and they don't require function composition to implement. They're p
by neuroticfish 6y ago
How are iterators functional language features? They're not unique to functional languages and they don't require function composition to implement. They're present in most popular imperative languages.
- rectang 6y agoEven 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".