To answer your last question, I'd probably do it like this: (def bitvector (reduce (fn [bm x] (conj bm (expt 2 x))) [] (range 63))) ;; Remember, vectors implement ifn.
Also, I believe using the bitshift operator (arguably) obscures your intentions without much benefit over expt. As to answering your other questions I'll leave that to someone more qualified. Cheers Andreas On 12 July 2012 17:38, john <john.vie...@gmail.com> wrote: > Hello, > I would like to avoid when possible the promotion from a primitve long to > an Long Object. > > I have the following code: http://pastie.org/4242382 and am not sure if > (Long) autoboxing is taking here place. > > In lines 24,28-30 I use "assoc" to replace a long in a defrecord. > > Since "assoc" is a clojure function does autoboxing take place when > "assoc" is called? > > Further if I in order to get rid of the repetitive "assoc" code replace > lines 28-30 with the following s-expression > > board (reduce (fn[b [k v]](assoc b k v)) board [[:white-pieces > white-pieces] > > [:black-pieces black-pieces] > > [:all-pieces (bit-or white-pieces black-pieces)]]) > > Does for example autoboxing of the long "black-pieces" take place? > > Is there a way,trick to check for autoboxing? (maybe using a debugger)? > > > One further advice question : > In line 1-4 I want to precompute an bitset therefore I have an aouter > "let" around "defn" . The code looks alittle unusual to me, but is it > allright? > > > > > -- > 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 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