amap, areduce ... hopefully afilter, aremove , aconcat, amapcat etc

2012-11-23 Thread Jim - FooBar();
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

Re: amap, areduce ... hopefully afilter, aremove , aconcat, amapcat etc

2012-11-23 Thread Jonathan Fischer Friberg
The exception is because (into-array [0 1 -7 2 -1 -3 4 5 -10]) is not an array of longs, use long-array instead. In the areduce, we also have to return ret after each computation, like so: (defn aremove [pred ^longs ns] (areduce ns i ret (long-array (alength ns)) (let [v (aget ns