25.5.10 Array Attributes

The following attributes are defined for array values.

size

Gives an offset with the storage occupied by the complete array. Example:

(poke) [1,2,3]'size
96UL#b
length

Gives the number of elements stored in the array. Example:

(poke) [1,2,3]'length
3
mapped

Boolean indicating whether the array is mapped. Examples:

(poke) var a = [1,2,3]
(poke) var b = int[3] @ 0#B
(poke) a'mapped
0
(poke) b'mapped
1
strict

Boolean indicating whether the array is mapped in strict mode. Examples:

(poke) var a = int[3] @ 0#B
(poke) a'strict
1
(poke) var a = int[3] @! 0#B
(poke) a'strict
0
elem (idx)

Element occupying the position idx in the array. Note that this attribute evaluates to a value of type any.

eoffset (idx)

Offset of the element identified by the index idx in the array. Examples:

(poke) [1,2,3]'eoffset (1)
32#b

If the provided index is out of bounds then E_out_of_bounds is raised.

esize (idx)

Size of the element identified by the index idx in the array. Examples:

(poke) ["foo","x",""]'esize (1)
16#b

If the provided index is out of bounds then E_out_of_bounds is raised.

ename (idx)

The string "[idx]".

If the provided index is out of bounds then E_out_of_bounds is raised.