elm-iter implements lazy iterators in ELM. More later :)
We can convert iterators from/to lists:
it = Iter.fromList [1, 2, 3]
lst = Iter.fromIter itBut iterators can also be infinite:
Iter.numbers --- generate all natural numbers starting at 0Of course, this is only useful because we have functions to transform, slice, and join different iterators
String.concat << Iter.toList
(Iter.take 11 <|
(Iter.intersperse ", " (Iter.map String.fromInt numbers))
)
=== "0, 1, 2, 3, 4, 5"