fromInteger x = [[fromInteger x]]
Wouldn't you want the expression
[[1,0],[0,2]] + 10
to yield
[[11,10],[10,12]]
instead of [[11]] ? I guess you would need some complicated machinery
so this is one thing you have to ignore to keep your otherwise nifty
instance nice and simple.
Jared.
--
http://www.updike.org/~jared/
reverse ")-:"
abs x = map (map abs) x
(+) [ ] y = y
(+) x [ ] = x
(+) x y = zipWith (zipWith (+)) x y
(*) x y = map (matrixXvector x) y
where
-- matrixXvector :: Num a => [[a]] -> [a] -> [[a]]
matrixXvector m v = foldl vectorsum [] $ zipWith vectorXnumber m v
-- vectorXnumber :: Num a => [a] -> a -> [a]
vectorXnumber v n = map (n*) v
-- vectorsum :: [a] -> [a] -> [a]
vectorsum [] y = y
vectorsum x [] = x
vectorsum x y = zipWith (+) x y
_______________________________________________________
Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular.
Registre seu aparelho agora!
http://br.mobile.yahoo.com/mailalertas/
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe