Map Iterable from type T to type B using the index.
T
B
Iterable<B> mapWithIndex<B>(B Function(T t, int index) f) => foldLeftWithIndex([], (a, e, i) => [...a, f(e, i)]);