On Jul 7, 5:06 pm, Isak Hansen <isak.han...@gmail.com> wrote: > On Wed, Jul 7, 2010 at 5:00 PM, Lars Nilsson <chamael...@gmail.com> wrote: > > > Maybe > > > (doseq [year (range 1999 2010 1)] > > (doseq [month (range 1 53 1)] > > (print-data year range))) > > You could also do this with dotimes instead of doseq. Doesn't matter > for Ns this small, but creating a range just so you have something to > iterate across is a bit wasteful.
That's the beauty of lazy sequences, and range produces a lazy sequence: http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/range At any point in time, only a single value from each range exists; the other values in the range are either garbage or don't exist (have not been computed) yet. I think this use of range is considered idiomatic Clojure. -Dave -- 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