functor VECTOR( structure Complex : ComplexSig) : VectorSig = struct open Complex; type scalar = complex type vector = complex * complex type matrix = vector * vector fun vector (x,y) = (x,y) fun matrix (a,b) = (a,b) fun scale (s,(a,b)) = vector (s ** a, s ** b) fun (a,b) dot (a',b') = a ** a' ++ b ** b' fun apply ((a,b),v) = vector (a dot v, b dot v) end;