George Kangas <gwkan...@gmail.com> writes: > Now I try to use "realized?" on 123456th element: > > user=> (realized? (nth naturals 123456)) > ClassCastException java.lang.Long cannot be cast to > clojure.lang.IPending clojure.core/realized? (core.clj:6505)
Hm, that's strange indeed. I also get user> (realized? (iterate int 0)) ;clojure.lang.Cons cannot be cast to clojure.lang.IPending ; Evaluation aborted. where I'd expect it to return false. However, it works just fine with `range' in place of iterate: user> (realized? (range 0 10)) false user> (realized? (doall (range 0 10))) true Bye, Tassilo > Ouch! I guess "realized?" isn't a macro. Next try: No, it's a function. But why should that be important. Ok, before a funcall all args are evaluated, but the result of evaluating a lazy seq is still the same lazy seq. Evaluation doesn't realize anything, only calling first/rest on the seq does. > Huh? How do I get "realized?" to tell me what I want to know? > > What I want to know, is wether the element at the nth index > has been computed and cached. Ditto. Bye, Tassilo -- 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