The difference is that the JVM version is correct and the CLR implementation has a bug.
I'll fix it in the current branch and try to get a patched 1.4 out as soon as I can. -- Above is all you really need to know, but I find myself forced to continue. :) -- This bug has sitting there from the first commit in the public repo. (That would be early 2009.) The line of code in question is testing for the IList interface. The line has a comment that the JVM implementation changed from IList to RandomAccess, which has no equivalent in the CLR. I didn't know why the change was made, so I left it alone. (The history is lost, but I can place the JVM version change between Nov 08 and Feb 09.) Four years later, I've just discovered the reason. The bug only surfaces in certain circumstances on infinite (lazy) sequences -- and specifically it is triggered by destructuring. LazySeq itself is not the problem -- that's used everywhere. -David On Thursday, November 15, 2012 9:23:05 AM UTC-6, ffailla wrote: > > I believe I have discovered differing behavior between the JVM and CLR > implementations when running the following statement: > > user> (let [foo (repeatedly (fn [] (let [r (rand)] > (println "in-repeat: " r) > r))) > [f & rst] foo] > (println "return: " f)) > > When run on the JVM with clojure 1.4.0, I get the following output: > > in-repeat: 0.6929552277817549 > in-repeat: 0.7005322422752974 > return: 0.6929552277817549 > nil > user> > > When run on the CLR with clojure-clr 1.4.0, the random number will be > printed from "in-repeat" infinitely, never to return. > > Is this difference between the JVM and CLR implementations when > destructuring a lazy sequence known? > > Also, why was the random number printed twice on the JVM side. I haven't > looked an the implementation, but I would guess this would be due to > chunking the sequence. Thanks. > > -Frank Failla > -- 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