Hi list,

I'm learning Clojure now and  I was confused by assoc!.

Here is my code , I want to use the code to distinct items (I cannot use 
'distinct' function here for some reasons.)

(defn fn2[x] 
  (vals (persistent!
    (reduce (fn [ret l] (assoc! ret l l ))
      (transient {}) x))))


user=> (fn2 (range 32))
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 
28 29 30 31)
user=> (fn2 (range 33))
(0 32 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 
27 28 29 30 31)
user=> (fn2 (range 50))
(0 32 1 33 2 34 3 35 4 36 5 37 6 38 7 39 8 40 9 41 10 42 11 43 12 44 13 45 
14 46 15 47 16 48 17 49 18 19 20 21 22 23 24 25 26 27 28 29 30 31)


*So my question is : ** why the result is not ordered when the size of 
input is larger than 32?*



Thanks


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