col ( n matrix -- col ) (original) (raw)

col ( n matrix -- col )
Matrix operations

Prev: rows-except ( matrix desc -- others )
Next: cols ( seq matrix -- cols )

Vocabulary
math.matrices

Inputs

n an integer
matrix a matrix

Outputs

col a sequence

Word description
Get the nth column of the matrix.

Notes
Like most Factor sequences, indexing is 0-based. The first column is given by m 0 col.

Examples

USING: kernel math.matrices prettyprint ; { { 1 2 } { 3 4 } } 1 swap col .
{ 2 4 }

Definition

USING: kernel sequences ;

IN: math.matrices

: col ( n matrix -- col ) swap [ swap nth ] curry map ; inline