indicesComplement
Return the complement of a list of array indices.
Usage
var indicesComplement = require( '@stdlib/array/base/indices-complement' );
indicesComplement( N, indices )
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.
Notes
- The function always returns a new "generic" array.
Examples
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 []