matrix-map ( matrix quot: ( ... elt -- ... elt' ) -- matrix' )
Matrix operations

Prev:matrix-except-all ( matrix -- submatrices )
Next:column-map ( matrix quot: ( ... col -- ... col' ) -- matrix' )


Vocabulary
math.matrices

Inputs
matrixa matrix
quota quotation with stack effect ( ... elt -- ... elt' )


Outputs
matrix'a matrix


Word description
Apply the quotation to every element of the matrix.

Notes
This word is intended for use with "flat" (2-dimensional) matrices.


Examples
USING: math.matrices kernel math prettyprint ; 3 <identity-matrix> [ zero? 15 -8 ? ] matrix-map .
{ { -8 15 15 } { 15 -8 15 } { 15 15 -8 } }


Definition


: matrix-map
( matrix quot: ( ... elt -- ... elt' ) -- matrix' )
[ map ] curry map ; inline