Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "math/iter/tools/map2/docs/types/index.d"

Index

Interfaces

Type aliases

Functions

Type aliases

Binary

Binary: (x: number, y: number) => any

Function which transforms iterated numeric values.

param

iterated value from first input iterator

param

iterated value from second input iterator

returns

result

Type declaration

    • (x: number, y: number): any
    • Parameters

      • x: number
      • y: number

      Returns any

Iterator

Iterator: Iter | IterableIterator

Functions

Export assignment iterMap2

  • Returns an iterator which invokes a binary function accepting numeric arguments for each iterated value.

    Notes

    • When invoked, the input function is provided two arguments:

      • x: iterated value from first input iterator
      • y: iterated value from second input iterator
    • If 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.

    throws

    must provide valid options

    Parameters

    • iter0: Iterator | number

      first iterator

    • iter1: Iterator | number

      second iterator

    • fcn: Binary

      function which transforms iterated values

    • Optional options: Options

      options

    Returns Iterator

    iterator

    Example

    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>
    
    // ...