I'm writing a function that can input strings, numbers, arrays, Java Collections and Maps. The constraints are the output for both strings and numbers should be zero.
The Clojure function count does everything I need, except handle the constraints. So, I thought to use an if statement to test if the input is a string or a number. Returning zero if the test is true, and using count otherwise. I have workable code for either case, but do not know how to combine the two. Moreover, I am not sure the most efficient way to set up the testing in this case.
(defn Swanson [a]
(if (string? a) 0
(count a)))
(defn Propello [b]
(if (instance? Number b) 0
(count b)))