Created
April 25, 2014 14:27
-
-
Save mdelaurentis/11291469 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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