=> (defn abc [] 3)
#'ants/abc

=> (loop [a 1]
     (when (= 1 a) (recur (abc))))
NO_SOURCE_FILE:2 recur arg for primitive local: a is not matching
primitive, had: Object, needed: long
Auto-boxing loop arg: a
nil

=> (loop [a 1]
     (when (= 1 a) (recur (long (abc)))))
nil

=> (loop [a 1]
     (when (= 1 a) (recur *(var defn)*)))
NO_SOURCE_FILE:2 recur arg for primitive local: a is not matching
primitive, had: Object, needed: long
Auto-boxing loop arg: a
nil

How was that boxed into long? :O
since this wouldn't work:

=> (loop [a 1]
     (when (= 1 a) (recur (long (var defn)))))
ClassCastException clojure.lang.Var cannot be cast to java.lang.Number
clojure.lang.RT.longCast (RT.java:1151)

=> (long (var defn))
ClassCastException clojure.lang.Var cannot be cast to java.lang.Number
clojure.lang.RT.longCast (RT.java:1151)


=> (loop [a 1]
     (cond (not (= 1 a))
       a
       :else
       (recur (var defn))))
NO_SOURCE_FILE:5 recur arg for primitive local: a is not matching
primitive, had: Object, needed: long
Auto-boxing loop arg: a
*#'clojure.core/defn*

Shouldn't it err saying that it can't autobox into long? or am I missing
the meaning here? it does say that it had Object and it needed long, does
that autoboxing make it Long or long? apparently it just leaves it as
is:*#'clojure.core/defn
*

Any thoughts on this?

=> (loop [a 1]
     (cond (not (= 1 a))
       a
       :else
       (recur (abc))))
NO_SOURCE_FILE:5 recur arg for primitive local: a is not matching
primitive, had: Object, needed: long
Auto-boxing loop arg: a
3

=> (loop [a 1]
     (cond (not (= 1 a))
       a
       :else
       (recur (long (abc)))))
3

this makes sense.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to