9 Jul
2003
9 Jul
'03
2:25 p.m.
I've learned haskell months, but I still can't understand the type system very well. I can only write: ----------------------------------- type Vector = [Double] vadd,vsub :: Vector->Vector->Vector v1 `vadd` v2 = zipWith (+) v1 v2 v1 `vsub` v2 = zipWith (-) v1 v2 svmul :: Double->Vector->Vector s `svmul` v = map (s*) v ------------------------------------ Tough it works, it is not convenient to use. How to create a Vector type and overload mathematical operators? Thanks for your help. Liu Junfeng liujf@softhome.net