matrix-set-nth ( obj pair matrix -- )
Matrix operations

Prev:matrix-nths ( pairs matrix -- elts )
Next:matrix-set-nths ( obj pairs matrix -- )


Vocabulary
math.matrices

Inputs
objan object
paira pair
matrixa matrix


Outputs
None

Word description
Set the element in the matrix at the 2D index given by pair to obj. This operation is destructive.

Side effects
Modifies matrix

Notes
This word is the two-dimensional variant of set-nth.
This word is intended for use with "flat" (2-dimensional) matrices.


Errors
bounds-error if the first element of a pair in pairs is greater than the maximum row index in matrix
bounds-error if the second element of a pair in pairs is greater than the maximum column index in matrix
Throws an error if the sequence cannot hold elements of the given type.


Examples
Change the entry at row 1, column 0.
USING: math.matrices kernel prettyprint ; { { 0 1 } { 2 3 } } "a" { 1 0 } pick matrix-set-nth .
{ { 0 1 } { "a" 3 } }


Definition