i need help about a rotation or spin matrix in haskell
i have a list of list, of a data type RGB:
data RGBdata= RGB Int Int Int
m = [[(RGB 0 255 255),(RGB 255 0 0)],[(RGB 255 255 255),(RGB 255 0 0)]]
to be seen better i have a matrix 2x2:
m = [[(RGB 1 2 3),(RGB 4 5 6)],
[(RGB 7 8 9),(RGB 1 5 9)]]
and i need 90° rotation, i mean something like:
m = [[(RGB 7 8 9),(RGB 1 2 3)]
[(RGB 1 5 9),(RGB 4 5 6)]]
Extends my explication, i have 2 data type:
data RGBdata= RGB Int Int Int
data PBMfile= PBM Int Int [[RGBdata]]
and my function receive:
spin :: PBMfile -> PBMfile
spin (PBM x y l) = (PBM x y ((transpose . reverse) l))
where 'x' and 'y' is the number of colums and rows respectively (maybe can help to do the function).
I try rotate 90° to the left with your anwer and the image result is wrong.
i try
spin :: PBMfile -> PBMfile
spin (PBM x y l) = (PBM x y ((reverse . transpose) l))
and
spin :: PBMfile -> PBMfile
spin (PBM x y l) = (PBM x y ((transpose . reverse) l))
and
spin :: PBMfile -> PBMfile
spin (PBM x y l) = (PBM x y (((map reverse) . transpose) l))
to rotate the image but does not work.
the result is something like