> Awesome Kevin. That solution is sexy. I don't even need the java > library anymore.
Note, however, that this can return (or do!) near anything, because it accepts any Clojure syntax. user=> (read-string "\"foo\"") "foo" ; a string user=> (read-string "(1.1)") (1.1) ; a list containing a float user=> (read-string "foo") user/foo ; an interned symbol including executing arbitrary code, unless you bind *read-eval*: user=> (read-string "#=(println \"Oof\")") Oof ; this gets printed. It could do much worse. nil In short... use the reader when you want to handle Clojure syntax. If you want to convert a string to a decimal, do it properly. You'll get useful exceptions, prevent bad input, and avoid inadvertent attack vectors. There's no "needing the Java library" -- you always have the core Java classes available, including Double and BigDecimal. HTH, -R -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
