(a 1) will return a boxed value and (long (a 1)) will just cast it back to a primitive. There is currently no way to efficiently deal with the contents of gvecs. Their inclusion at this point is mostly about saving memory.
In theory reducers could allow a primitive fn to do efficient work "inside". As far as getting a particular element without boxing, I don't see a way to do that without implementing some interface like nthLong, nthDouble etc. Maybe invokeDynamic could help here in the future? David On Thu, Oct 10, 2013 at 11:38 AM, Mark Engelberg <mark.engelb...@gmail.com>wrote: > So do you just do: > (inc (long (a 1))), i.e., manually converting to long primitive? Is there > much overhead for that call, if it is already a primitive? > > To the best of my knowledge, you can't do: > (let [^long x (a 1)] (inc x)) > because I think primitive type hints only work in function headers. Is > that correct? > > Thanks, > > Mark > > > > > > On Thu, Oct 10, 2013 at 5:09 AM, David Nolen <dnolen.li...@gmail.com>wrote: > >> Not that I'm aware of. >> >> >> On Thursday, October 10, 2013, Mark Engelberg wrote: >> >>> (def a (conj (vector-of :long) 1 2 3) >>> (inc (a 1)) >>> >>> Is Clojure smart enough to figure out that (a 1) is a primitive long and >>> call the fast primitive version of inc? >>> >>> -- >>> -- >>> 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 >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "Clojure" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to clojure+unsubscr...@googlegroups.com. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> -- >> -- >> 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 >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- > -- > 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 > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.