Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@duncanmak
Created September 30, 2010 20:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duncanmak/605263 to your computer and use it in GitHub Desktop.
Save duncanmak/605263 to your computer and use it in GitHub Desktop.
(defmulti distance #(vector (class %1) (class %2)))
(defmethod distance [IPersistentVector IPersistentVector]
[p q]
(let [[x1 y1] p, [x2 y2] q]
(.distance (Point. x1 y1) (Point. x2 y2))))
(defmethod distance [Point Point]
[p q] (.distance p q))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment