Created
October 31, 2014 00:57
-
-
Save alextucker/2f8600d30673acd5d416 to your computer and use it in GitHub Desktop.
Simple Clojure String Calculator
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
(defn string-to-int-list | |
[string-list] | |
(map read-string (str/split string-list #"\s|,"))) | |
(defn string-calculator | |
[numbers] | |
(if (= numbers "") 0 | |
(reduce + (string-to-int-list numbers)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment