Earlier quoted context omitted.
I program mainly in C++, and I often start off writing things as: for (auto x : someContainer) { //do something with x } But inevitably, I end up needing either an iterator pointing to a particular item at the end, or I need an index to pass to some other function, and this style makes that impossible. Perhaps it's just the domain I work in, but even after years of trying to make this work, it still only works about…
In Haskell map someFunction listOfValue if you need an index: map someOtherFunction (zip [0..] listOfValues) Python uses 'enumerate' to similar effect. Not sure if C++ has an equivalent?
zipWith someOtherFunction [0..] listOfValues
# , since someOtherFunction is likely to be
# :: (Int -> Value -> Stuff) rather than
# :: ((Int,Value) -> Stuff) .
zipIndex f = zipWith f [0..]
# is also often useful.