Many thanks to you Bill - it works!

.Bill Smith  at "Fri, 1 Jan 2010 10:44:37 -0800 (PST)" wrote:
 .S> Happy New Year to you, Alex.

 .S> I reproduced the problem as follows:

 .S> user=> (loop [x (byte 0) count 0]
 .S>   (if (< count 10) (recur 0 (inc count))))
 .S> java.lang.RuntimeException: java.lang.IllegalArgumentException: recur
 .S> arg for primitive local: x must be matching primitive (NO_SOURCE_FILE:
 .S> 57)
 .S> user=>

 .S> If the compiler detects that a loop binding evaluates to a primitive,
 .S> it insists that the corresponding recur argument be a reducible to a
 .S> primitive as well.  You can short-circuit that logic with a type hint,
 .S> like this:

 .S> user=> (loop [x #^Object (byte 0)]
 .S>   (if (< x 10) (recur (inc x))))
 .S> nil
 .S> user=>

 .S> It's ugly but it works.  If you change line 65 in your example from
 .S> "char (.read ireader)]" to "char #^Object (.read ireader)]", the
 .S> compile error should go away.  The example in my previous posting
 .S> didn't have that problem because 0 by itself is an Integer object, not
 .S> an int primitive.

-- 
With best wishes, Alex Ott, MBA
http://alexott.blogspot.com/        http://xtalk.msk.su/~ott/
http://alexott-ru.blogspot.com/

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