Created
December 8, 2017 22:56
-
-
Save rafaelrinaldi/72bd2748352c3dbf1151d27af5693476 to your computer and use it in GitHub Desktop.
This file contains 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
(defmulti parse-int (fn [x] (class x))) | |
(defmethod parse-int String [x] | |
(try (Integer/parseInt x) (catch RuntimeException re 0))) | |
(defmethod parse-int nil [_] 0) | |
(defmethod parse-int Number [x] x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment