Oh good -- take-while will stop right when it encounters the first item it can't take? Perfect. Too bad there is a tradeoff between idioms and performance. Thanks for the help!
On Jul 21, 9:15 pm, Dmitry Gutov <raa...@gmail.com> wrote: > The first version stops as soon it encounters the first item in the > collection that's too big. > The second version filters the whole collection, which may lead to a > major slowdown, depending on coll's relative size. It will also hang > if coll is infinite. > This should be better: (take-while #(<= % limit) coll) > > That said, a properly written loop will always be faster that an > idiomatic version using first-order functions. > > On Jul 22, 12:17 am, nil <ache...@gmail.com> wrote: > > > > > Oh right. What you said is what I meant. I renamed the functions > > improperly and then fooled myself. But I still can't figure out why > > the second one is much slower. -- 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