Return the complement of a list of array indices.
var indicesComplement = require( '@stdlib/array/base/indices-complement' );
Returns the complement of a list of array indices.
var idx = indicesComplement( 5, [ 1, 2 ] );
// returns [ 0, 3, 4 ]
The function accepts the following arguments:
- N: array length.
- indices: list of indices from which to derive the complement.
- The function always returns a new "generic" array.
var indicesComplement = require( '@stdlib/array/base/indices-complement' );
var out = indicesComplement( 5, [ 1, 3, 4 ] );
// returns [ 0, 2 ]
out = indicesComplement( 5, [ 0, 1 ] );
// returns [ 2, 3, 4 ]
out = indicesComplement( 5, [ 0 ] );
// returns [ 1, 2, 3, 4 ]
out = indicesComplement( 5, [] );
// returns [ 0, 1, 2, 3, 4 ]
out = indicesComplement( 5, [ 0, 1, 2, 3, 4 ] );
// returns []