transpose package:rio

The transpose function transposes the rows and columns of its ByteString argument.
The transpose function transposes the rows and columns of its argument.

Laziness

transpose is lazy in its elements
>>> take 1 (transpose ['a' : undefined, 'b' : undefined])
["ab"]

Examples

>>> transpose [[1,2,3],[4,5,6]]
[[1,4],[2,5],[3,6]]
If some of the rows are shorter than the following rows, their elements are skipped:
>>> transpose [[10,11],[20],[],[30,31,32]]
[[10,20,30],[11,31],[32]]
For this reason the outer list must be finite; otherwise transpose hangs:
>>> transpose (repeat [])
* Hangs forever *
transpose for NonEmpty, behaves the same as transpose The rows/columns need not be the same length, in which case > transpose . transpose /= id
O(n) The transpose function transposes the rows and columns of its Text argument. Note that this function uses pack, unpack, and the list version of transpose, and is thus not very efficient. Examples:
>>> transpose ["green","orange"]
["go","rr","ea","en","ng","e"]
>>> transpose ["blue","red"]
["br","le","ud","e"]
O(n) The transpose function transposes the rows and columns of its Text argument. Note that this function uses pack, unpack, and the list version of transpose, and is thus not very efficient.