Binding to [& rst] must realize an element of the sequence, to determine if there are any left, and it promises to never bind (), only nil.
On Thursday, November 15, 2012 7:23:05 AM UTC-8, 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 [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
