2008-02-18 17:30:37 +00:00
|
|
|
(* vim: set ts=2 sw=2 et : *)
|
|
|
|
type t = int * int
|
2008-02-18 08:55:16 +00:00
|
|
|
|
2008-02-18 17:30:37 +00:00
|
|
|
let zero = (0, 0);;
|
2008-02-18 08:55:16 +00:00
|
|
|
|
2008-02-18 17:30:37 +00:00
|
|
|
let ( + ) x y =
|
|
|
|
let (xa, xb) = x
|
|
|
|
and (ya, yb) = y
|
|
|
|
in (xa + ya, xb + yb)
|
|
|
|
;;
|
|
|
|
|
|
|
|
let ( - ) x y =
|
|
|
|
let (xa, xb) = x
|
|
|
|
and (ya, yb) = y
|
|
|
|
in (xa + ya, xb + yb)
|
|
|
|
;;
|
|
|
|
|
|
|
|
let ( * ) x y =
|
|
|
|
let (xa, xb) = x
|
|
|
|
and (ya, yb) = y
|
|
|
|
in (xa * ya, xb * yb)
|
|
|
|
;;
|
|
|
|
|
|
|
|
let dot x y =
|
|
|
|
let (xa, xb) = x
|
|
|
|
and (ya, yb) = y
|
|
|
|
in
|
|
|
|
let na = xa * yb
|
|
|
|
and nb = xb * ya
|
|
|
|
in ( na, nb )
|
|
|
|
;;
|