Skip to content

Instantly share code, notes, and snippets.

@rafaelrinaldi
Created December 8, 2017 22:56
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 rafaelrinaldi/72bd2748352c3dbf1151d27af5693476 to your computer and use it in GitHub Desktop.
Save rafaelrinaldi/72bd2748352c3dbf1151d27af5693476 to your computer and use it in GitHub Desktop.
(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