map2<T, U, V> function
A map
function that takes in 2 iterables. The Iterables must be of
equal length.
Implementation
Iterable<V> map2<T, U, V>(
Iterable<T> ts, Iterable<U> us, V Function(T t, U u) func) sync* {
final Iterator<T> itt = ts.iterator;
final Iterator<U> itu = us.iterator;
while (itu.moveNext() && itt.moveNext()) {
yield func(itt.current, itu.current);
}
if (itu.moveNext() || itt.moveNext()) {
throw ArgumentError("Iterables aren't of equal length.");
}
}