Happy New Year to you, Alex. I reproduced the problem as follows:
user=> (loop [x (byte 0) count 0] (if (< count 10) (recur 0 (inc count)))) java.lang.RuntimeException: java.lang.IllegalArgumentException: recur arg for primitive local: x must be matching primitive (NO_SOURCE_FILE: 57) user=> If the compiler detects that a loop binding evaluates to a primitive, it insists that the corresponding recur argument be a reducible to a primitive as well. You can short-circuit that logic with a type hint, like this: user=> (loop [x #^Object (byte 0)] (if (< x 10) (recur (inc x)))) nil user=> It's ugly but it works. If you change line 65 in your example from "char (.read ireader)]" to "char #^Object (.read ireader)]", the compile error should go away. The example in my previous posting didn't have that problem because 0 by itself is an Integer object, not an int primitive. On Dec 31 2009, 12:45 pm, Alex Ott <alex...@gmail.com> wrote: > Hello Bill > > .Bill Smith at "Thu, 31 Dec 2009 09:20:16 -0800 (PST)" wrote: > .S> I tried out your example with a couple of files and it appeared to > .S> work. Is it supposed to fail, or is this an example of what you had > .S> to do to work around the problem you mentioned? > > Yes, this is working variant > > if you'll replace '(.read ireader)' in 'recur' on line 80 with 'res', then > it will fail. > > .S> It's certainly ok for a function to return different data types. I > .S> guess the simplest example of that would be the identity function. > > thanks for identity example, i'll look to it > > P.S. Happy New Year to you, and rest of clojure community > > -- > With best wishes, Alex Ott, MBAhttp://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