One more thing…

If I try this, it looks okay
user=> (Integer/parseInt (:value (j1 (keyword "abcdef"))))
10

But within the function, I get cast exceptions.

user=> j1
{:abcdef {:value "10"}}
user=> j2
{:abcdef {:value "20"}}
user=> (defn metric-diff [metric & json-objs]
    (apply - (map (comp (Integer/parseInt :value) (keyword metric))
json-objs)))
#'user/metric-diff
user=> (keyword "abcdef")
:abcdef
user=> (metric-diff (keyword "abcdef") j1 j2 )
java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to
java.lang.String (NO_SOURCE_FILE:0)

How can I coerce the JSON stringified numbers into integers ?

-Avram

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to