Hi, Am 07.07.2010 um 18:04 schrieb Greg:
>> If you don't need the intermediate seq you can use doseq directly: >> >> (doseq [y (range 1999 2011) >> w (range 1 53)] >> (println "Year" y "Week" w)) > > That's really cool, I didn't know you can do that. for and doseq are quite similar in its form, but completely different in semantics: for creates a lazy sequence(*) while doseq performs the body. But they support a quite similar set of modifiers in the bindings: (for [x (range 10) :let [y (inc x)] :when (even? y)] x) => (1 3 5 7 9) (doseq [x (range 10) :let [y (inc x)] :when (even? y)] (println x)) 1 3 5 7 9 => nil As I said in a different thread: consistency matters. And clojure is full of it. Sincerely Meikel (*) That's the reason why the body of for is *not* wrapped into an implicit do. -- 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