Skip to content

Instantly share code, notes, and snippets.

/string.clj
Created Apr 23, 2014

Embed
What would you like to do?
(defn c [x] (if (empty? x) 0 (apply + (map #(Integer/parseInt %) (clojure.string/split x #",")))))
(comment
user=> (c "")
0
user=> (c "0")
0
user=> (c "5")
5
user=> (c "5,3")
8
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.