Skip to content

Instantly share code, notes, and snippets.

@mdelaurentis
Created April 25, 2014 14:27
Show Gist options
  • Select an option

  • Save mdelaurentis/11291469 to your computer and use it in GitHub Desktop.

Select an option

Save mdelaurentis/11291469 to your computer and use it in GitHub Desktop.
(defprotocol Ageable
(age [this]))
(defprotocol Nameable
(get-name [this]))
(defrecord Person [first-name last-name birthday]
Ageable
(age [this]
(- now birthday))
Nameable
(get-name [this]
(str first-name " " last-name))
java.lang.Comparable
(compareTo [this other]
(- (age this) (age other)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment