Thanks Alan, that makes sense. This code example illustrates that Clojure values can already be primitive ints:
user=> (let [i 1] (primitive-type i)) :long user=> (let [i (Integer/parseInt "1")] (primitive-type i)) :int So it appears that Clojure's behavior is case #2 from my last comment. All I'm proposing is that when Clojure needs to box a primitive int, that Clojure box it as an Integer rather than a Long. Then this code example: (let [m {:a (Integer/parseInt "1")}] (map class (vals m))) will behave the same as this one: (let [m {:a (Integer/valueOf "1")}] (map class (vals m))) -Nathan On Oct 20, 9:35 pm, Alan Malloy <a...@malloys.org> wrote: > It is a Long object. Vars hold objects, so it has to be boxed. > However, if instead of def'ing it you immediately called some java > method that will accept either a primitive int or a primitive long, my > understanding is that Clojure would arrange for the int version to be > called, because no boxing would happen. > > On Oct 20, 9:11 pm, nathanmarz <nathan.m...@gmail.com> wrote: > > > > > > > > > Now I'm confused. So when I do this: > > > (def i (Integer/parseInt "1")) > > > Is "i" a primitive int, a primitive long, or a Long object? -- 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