[Haskell-cafe] Transpose using array comprehension
Henning Thielemann
lemming at henning-thielemann.de
Wed Apr 18 05:54:15 EDT 2007
On Wed, 18 Apr 2007, Chris Witte wrote:
> I just started playing around with GHC.PArr and array comprehension
> and I was wondering if there is a way to define the transpose of a
> matrix using array comprehension?
Why not
let swap :: (i,j) -> (j,i)
swap (a,b) = (b,a)
in ixmap (let (lower,upper) = bounds arr in (swap lower, swap upper))
swap arr
?
More information about the Haskell-Cafe
mailing list