Re: How to return a value from catch block

2014-07-13 Thread Thomas Heller
catch returns the value of the last statement, so instead of the (str) you could just return 0.0. Also don't use read-string if you only expect floating point numbers, otherwise (convert-to-float ":hmm") returns :hmm, not exactly a float. Since closure uses Double as the default floating point

Re: How to return a value from catch block

2014-07-13 Thread Torsten Uhlmann
You could wrap the catch expression in a do block and return something at the end of the block. That means that the other statements in the do block must produce some side effect, like logging the error message: (defn convert-to-float [a] (try (if (not= a " ") (read-string a)) (ca