"Z.A" <zahmed...@gmail.com> writes: > Meikel : To get the sequence printing logic i tried following code. Makes > no sense to me. > > (def lazy2 (take 3 (iterate #(do > (cond > (= 0 %) (print "+") > (= 1 %) (print "*") > (= 2 %) (print "$") > :else (print "oh no")) > (inc %)) 0))) > > user=> lazy2 > (+0 *1 2) > > Bad..No $.
Because the 2 is computed when your function is called with 1, and thus * is printed. If you'd take 4, you get (+0 *1 $2 3). 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