On 21.04.2009, at 00:19, Michael Hunger wrote:
> > Is it possible to use :while to shortcut a for macro when a certain > number of yiels have happened? > > e.g. (for [x (range 1000) :when (= (rem x) 1) :while (number of > yields <= 10)] > > so i want only the first 10 results. you could: (def zip (partial map vector)) and then use: user> (for [[i x] (zip (iterate inc 0) (range 10 -10 -1)) :while (< i 5)] x) (10 9 8 7 6) > Or should I just use (take 10 ) on the for ? that's probably more readable and works just as well ;). hth, --Chris --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---