Skip to content

Instantly share code, notes, and snippets.

@ordnungswidrig
Created September 18, 2009 21:14
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 ordnungswidrig/189297 to your computer and use it in GitHub Desktop.
Save ordnungswidrig/189297 to your computer and use it in GitHub Desktop.
(defmulti draw (fn [ shape & rest ] shape))
(defmethod draw ::shape [x y] "shape")
(derive ::shape ::rect)
(defmethod draw ::rect [x y w h] "rect")
(derive ::shape ::eclipse)
(defmethod draw ::rect [x y w h] "eclipse")
(derive ::shape ::triangle)
(println (draw ::rect 1 2 3 4))
(println (draw ::triangle 1 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment