
22 Jun
2006
22 Jun
'06
6:56 a.m.
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)