array-nth ( n array -- elt ) (original) (raw)

array-nth ( n array -- elt )
Factor handbook » The language » Collections » Arrays » Unsafe array operations

Next: set-array-nth ( elt n array -- )

Vocabulary
sequences.private

Inputs

n a non-negative fixnum
array an array

Outputs

elt an object

Word description
Low-level array element accessor.

Warning
This word is in the sequences.private vocabulary because it is unsafe. It does not check types or array bounds, and improper use can corrupt memory. User code must use nth instead.

Definition

USING: kernel math.private slots.private ;

IN: sequences.private

: array-nth ( n array -- elt ) swap 2 fixnum+fast slot ; inline