Created
July 3, 2016 10:37
-
-
Save Anderssorby/3d02c99f1655756a448a39dcc60c58f7 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
;; An infix calculator | |
(defn calc [& x] | |
(loop [a (first x) b (second x) c (nth x 2) remainding (drop 3 x)] ;; This loop is unnecessary complex | |
(let [result (b a c)] | |
(if (empty? remainding) | |
result | |
(recur | |
result | |
(first remainding) | |
(second remainding) | |
(drop 2 remainding) | |
))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment