Skalarprodukt von zwei Vektoren von Zahlen:
skal :: [Int] -> [Int] -> Int skal xs ys = case (xs,ys) of ( [], [] ) -> 0 ( x:xs', y:ys' ) -> x*y + skal xs' ys'Skalarprodukt für beliebige Vektoren:
data Num_Dict a = Num_Dict { zero :: a , plus :: a -> a -> a , times :: a -> a -> a } skal :: Num_Dict a -> [a] -> [a] -> a skal d xs ys = ...