function put( x, indices, values, mode ) {
	var getIndex;
	var stride;
	var max;
	var xo;
	var io;
	var vo;

	// Broadcast the `values` array...
	if ( indices.length > 0 ) { // note: this allows `indices` to be empty and `values` to be non-empty (and not broadcast compatible with `indices`) to allow the potential use case where having an empty `indices` array is expected behavior and you don't want to trigger an exception simply because `values` has elements
		// Note that this effectively in-lines logic from `@stdlib/array/base/broadcast-array` in order to avoid unnecessary object creation...
		if ( values.length === indices.length ) {
			stride = 1;
		} else if ( values.length === 1 ) {
			stride = 0;
		} else {
			throw new Error( format( 'invalid argument. The third argument must be broadcast compatible with the second argument. Array shape: (%d). Desired shape: (%d).', values.length, indices.length ) );
		}
	}
	// Resolve a function for returning an index according to the specified index mode:
	getIndex = ind( mode );

	// Resolve the maximum index:
	max = x.length - 1;

	xo = arraylike2object( x );
	io = arraylike2object( indices );
	vo = arraylike2object( values );
	if (
		xo.accessorProtocol ||
		io.accessorProtocol ||
		vo.accessorProtocol
	) {
		// Note: we only explicitly support select dtype pairs, as this function should not be concerned with casting rules, etc. That is left to userland...
		if ( isComplexDataType( xo.dtype ) && isComplexDataType( vo.dtype ) ) {
			complex( reinterpretComplex( x, 0 ), io, reinterpretComplex( values, 0 ), stride, getIndex, max ); // eslint-disable-line max-len
			return x;
		}
		if ( isBooleanDataType( xo.dtype ) && isBooleanDataType( vo.dtype ) ) {
			boolean( reinterpretBoolean( x, 0 ), io, reinterpretBoolean( values, 0 ), stride, getIndex, max ); // eslint-disable-line max-len
			return x;
		}
		accessors( xo, io, vo, stride, getIndex, max );
		return x;
	}
	indexed( x, indices, values, stride, getIndex, max );
	return x;
}
Replaces specified elements of an array with provided values.

@param {Collection} x - input array
@param {IntegerArray} indices - list of indices
@param {Collection} values - values to set
@param {string} mode - index mode
@throws {Error} third argument must be broadcast compatible with the second argument
@returns {Collection} input array

@example
var x = [ 1, 2, 3, 4 ];

var indices = [ 1, 2 ];
var values = [ 20, 30 ];

var out = put( x, indices, values, 'throw' );
// returns [ 1, 20, 30, 4 ]

var bool = ( out === x );
// returns true

@example
var x = [ 1, 2, 3, 4 ];

var indices = [ 1, 2 ];
var values = [ 30 ];

var out = put( x, indices, values, 'throw' );
// returns [ 1, 30, 30, 4 ]

var bool = ( out === x );
// returns true