Source

hack-and-slash / vec.ml

open Core.Std

module Export = struct
  type _vec = { x: int; y : int } with sexp, bin_io
  let vec x y = { x; y }
end

type t = Export._vec = { x: int; y: int } with sexp, bin_io

let add t1 t2 =
  { x = t1.x + t2.x
  ; y = t1.y + t2.y
  }