Hi all,

For the past 2 hours I've been trying to write 'afilter' or 'aremove' on top of 'areduce' but I'm totally failing...something goes wrong with the type hints I suspect...I started with the simplest case possible:

  (defn aremove [pred ^longs ns]
   (areduce ns i ret (long-array (alength ns))
     (when-not (pred (aget ns i))
       (aset ret i (aget ns i) ))))


=> #'user/aremove

(aremove pos? (into-array [0 1 -7 2 -1 -3 4 5 -10]))

=> ClassCastException [Ljava.lang.Long; cannot be cast to [J user/aremove (NO_SOURCE_FILE:2)

I've tried casting all agets/asets to ^longs but the same thing happens...actually i get no refelction warning for this simple case...Can you see any errors? I was hoping I could write all them up on top of areduce and contribute them back to Clojure...has anyone tried creating array-based version of all those fns before?

thanks a lot

Jim


--
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