On Thu, Jun 22, 2006 at 11:57:37AM +0200, Udo Stenzel wrote:
> instance Num a => Num [[a]] where
>       (+) = zipWith (zipWith (+))
>       (-) = zipWith (zipWith (-))
>       negate = map (map negate)
>       fromInteger x = fix (((x : repeat 0) :) . map (0:))
>       m * n = [ [ sum $ zipWith (*) v w | w <- transpose n ] | v <- m ] 

or perhaps

        fromInteger x = iterate (0:) (x : repeat 0)

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to