Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "utils/map4d/docs/types/index.d"

Index

Functions

Functions

Export assignment map4d

  • Applies a function to each nested element in a four-dimensional nested array and assigns the result to a nested element in a new four-dimensional nested array.

    Notes

    • The applied function is provided the following arguments:

      • value: array element.
      • i0: index of the first dimension.
      • i1: index of the second dimension.
      • i2: index of the third dimension.
      • i3: index of the fourth dimension.
      • arr: input array.

    Parameters

    Returns Array < Array < Array < Array < any > > > >

    four-dimensional nested array

    Example

    var naryFunction = require( `@stdlib/utils/nary-function` );
    var abs = require( `@stdlib/math/base/special/abs` );
    
    var arr = [
        [ [ [ -1, -2, -3 ] ] ],
        [ [ [ -4, -5, -6 ] ] ]
    ];
    
    var out = map4d( arr, naryFunction( abs, 1 ) );
    // returns [ [ [ [ 1, 2, 3 ] ] ], [ [ [ 4, 5, 6 ] ] ] ]