Skip to content

Instantly share code, notes, and snippets.

@szastupov
Created November 5, 2009 22:48
Show Gist options
  • Save szastupov/227480 to your computer and use it in GitHub Desktop.
Save szastupov/227480 to your computer and use it in GitHub Desktop.
let vec_map f (x1, y1) (x2, y2) =
f x1 x2, f y1 y2
let (|+) = vec_map (+.)
let (|-) = vec_map (-.)
let (|*) s (x, y) =
s *. x, s *. y
let length (x, y) =
sqrt (x**2. +. y**2.)
let distance a b =
length (b |- a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment