flip ( matrix -- newmatrix )

Factor handbook » The language » Collections » Sequence operations » Reshaping sequences

Factor handbook » The language » Collections » Sequence operations » Reshaping sequences

Prev: | <reversed> ( seq -- reversed ) |

Vocabulary

sequences

Inputs

Outputs

Word description

Transposes the matrix; that is, rows become columns and columns become rows.

Examples

Definition

sequences

Inputs

matrix | a sequence of equal-length sequences |

Outputs

newmatrix | a sequence of equal-length sequences |

Word description

Transposes the matrix; that is, rows become columns and columns become rows.

Examples

USING: prettyprint sequences ;
{ { 1 2 3 } { 4 5 6 } } flip .

{ { 1 4 } { 2 5 } { 3 6 } }

{ { 1 4 } { 2 5 } { 3 6 } }

Definition