Created
June 10, 2010 16:38
-
-
Save swannodette/433269 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns unchecked-remainder-test) | |
(defn create-test-ary [] | |
(let [a (longs (make-array Long/TYPE 100))] | |
(amap a i result | |
(aset result i (long (rand-int 100)))))) | |
(defn ^:static test-map [ary] | |
(amap ary idx result | |
(let [i (unchecked-remainder idx 4) | |
j (if (= idx (long 0)) i (unchecked-divide idx 10))] | |
(aset result idx (long j))))) | |
(defn ^:static test-reduce ^long [ary ^long i ^long j] | |
(let [ary (longs ary)] | |
(areduce ary i sum (long 0) | |
(+ sum (aget ary i))))) | |
(test-map (create-test-ary)) ; [Thrown class java.lang.NoClassDefFoundError] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment