Design Patterns Revisited: Iterators II

I am learning Haskell afresh now, and it turns out that the iterator pattern is REALLY invisible in Haskell. This is a departure from other languages that claim to make iterators invisible like python, ruby and smalltalk, where although the syntax is minimal, you still need to understand the concept of iterators to use them. In Haskell, all expressions are lazily evaluated, so there's never even a need for the CONCEPT of iterators. Lazy evaluation of objects in lists or any collection - or any expression, for that matter -  is given to you by default.

blog comments powered by Disqus