Replace also (unchecked-add count 1) with (unchecked-add count (int 1)) (this should get easier in 1.3)
On Tue, Aug 31, 2010 at 4:20 PM, tsuraan <tsur...@gmail.com> wrote: >> (defn countnl-lite >> [#^bytes buf] >> (areduce buf idx count (int 0) >> (if (= (clojure.lang.RT/aget buf idx) 10) >> (unchecked-add count 1) >> count))) >> >> Key points are initializing count to a primitive integer and directly >> calling clojure's aget to avoid an unnecessary integer cast. > > Are you using clojure 1.2? If I try to set count to be (int 0) rather > than 0, I get this error: > > Exception in thread "main" java.lang.RuntimeException: > java.lang.IllegalArgumentException: recur arg for primitive local: > count must be matching primitive > > Even if I replace "inc" with the unchecked-add, or "cast" the result > of the inc to be "int" (replace (inc count) with (int (inc count)) ) > it gives me that error. Sort of strange... > > -- > 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