aset

aset — sets an array element to a value at a given index.

Syntax

aset (array, index, value)

		

Arguments

array

An array.

index

A numeric index into the array.

value

The new value to be placed in the array.

Returns

The value argument.

Description

Sets an array element to the value at the index. If the index is past the end of the array, then the array will be extended with nils to the index and the value inserted.

[Note]

This function can also be called using square bracket syntax for referencing array elements, with the syntax:

array[index]

Example

Gamma> x = array (3, 5, #b, nil);
[3 5 b nil]
Gamma> aset(x, 3, 7);
7
Gamma> x;
[3 5 b 7]
Gamma> x[0] = 9;
9
Gamma> x;
[9 5 b 7]
Gamma> 
		

See Also

array, aref, insert, delete, sort