>>> take 1 (transpose ['a' : undefined, 'b' : undefined]) ["ab"]
>>> 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 ["green","orange"] ["go","rr","ea","en","ng","e"]
>>> transpose ["blue","red"] ["br","le","ud","e"]
transpose (V3 (V2 1 2) (V2 3 4) (V2 5 6))V2 (V3 1 3 5) (V3 2 4 6)
>>> 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 is lazy:
>>> take 1 (transpose ['a' : undefined, 'b' : undefined]) ["ab"]
>>> 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]]
( 1 2 3 ) ( 1 4 7 ) ( 4 5 6 ) ( 2 5 8 ) transpose ( 7 8 9 ) = ( 3 6 9 )
genIntMatrix /\ \a -> Matrix.rows a == Matrix.columns (Matrix.transpose a)
genIntMatrix /\ \a -> Matrix.columns a == Matrix.rows (Matrix.transpose a)
genIntMatrix /\ \a -> genSameMatrix a /\ \b -> Laws.homomorphism Matrix.transpose (+) (+) a b
transpose empty == empty transpose (vertex x) == vertex x transpose (edge x y) == edge y x transpose . transpose == id transpose (box x y) == box (transpose x) (transpose y) edgeList . transpose == sort . map swap . edgeList
>>> 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 *
>>> import Data.Massiv.Array >>> arr = makeArrayLinearR D Seq (Sz (2 :. 3)) id >>> arr Array D Seq (Sz (2 :. 3)) [ [ 0, 1, 2 ] , [ 3, 4, 5 ] ] >>> transpose arr Array D Seq (Sz (3 :. 2)) [ [ 0, 3 ] , [ 1, 4 ] , [ 2, 5 ] ]