Almost right. The iterate function is an infinite sequence generator, so (count (iterate f x)) will never return.
If you want the iteration to terminate when cond is false (as in your original example), you're looking for this: (count (take-while cond (iterate (fn [[a b]] ... [new-a new-b]) [init-a init -b]))) Happy hacking! -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
