Returns an iterator which invokes a binary function accepting numeric arguments for each iterated value.
When invoked, the input function is provided two arguments:
x
: iterated value from first input iteratory
: iterated value from second input iteratorIf provided a numeric value as an iterator argument, the value is broadcast as an infinite iterator which always returns the provided value.
If an iterated value is non-numeric (including NaN
), the returned iterator returns NaN
. If non-numeric iterated values are possible, you are advised to provide an iterator which type checks and handles non-numeric values accordingly.
The length of the returned iterator is equal to the length of the shortest provided iterator. In other words, the returned iterator ends once one of the provided iterators ends.
If an environment supports Symbol.iterator
and all provided iterators are iterable, the returned iterator is iterable.
first iterator
second iterator
function which transforms iterated values
options
iterator
var randu = require( `@stdlib/random/iter/randu` );
var copysign = require( `@stdlib/math/base/special/copysign` );
var iter = iterMap2( randu(), randu(), copysign );
var r = iter.next().value;
// returns <number>
r = iter.next().value;
// returns <number>
r = iter.next().value;
// returns <number>
// ...
Function which transforms iterated numeric values.
iterated value from first input iterator
iterated value from second input iterator
result