column-map ( matrix quot: ( ... col -- ... col' ) -- matrix' )
Matrix operations

Prev:matrix-map ( matrix quot: ( ... elt -- ... elt' ) -- matrix' )
Next:stitch ( m -- m' )


Vocabulary
math.matrices

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


Outputs
matrix'a sequence, a matrix, or f


Word description
Apply the quotation to every column of the matrix. The output of the quotation must be a sequence.

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


Examples
USING: sequences math.matrices prettyprint ; 3 <identity-matrix> [ reverse ] column-map .
{ { 0 0 1 } { 0 1 0 } { 1 0 0 } }


Definition


: column-map
( matrix quot: ( ... col -- ... col' ) -- matrix' )
[ transpose ] dip map transpose ; inline