Closed sonwh98 closed 8 years ago
What happens if you leave off the coerce/safe
?
It seems like the re-matches
might throw an exception if the x
it is testing against is not a String
(or CharSequence
).
Would it work if you prefixed the re-matches
with a check to make sure x
is a string? e.g.:
(cond
(and (string? x) (re-matches #"^\d+\.*\d+$" x)) (parseDouble x)
...)
I think @davegolland has the right answer. You could also reorder the clauses to put the integer?
one first. If this doesn't resolve the issue, please feel free to reopen with more context. Thanks!
coerce-product does not seem to coerce :product/price from integer to double. It works if :product/price is a String but dhe conerce/safe closure does not get executed when price is an integer. How can I coerce an integet to a double?