user=> (doc take-while)
-------------------------
clojure.core/take-while
([pred coll])
  Returns a lazy sequence of successive items from coll while
  (pred item) returns true. pred must be free of side-effects.
nil
user=>


On Thu, May 7, 2009 at 2:11 PM, CuppoJava <patrickli_2...@hotmail.com> wrote:
>
> I'm trying to accomplish the following:
> Create a lazy sequence of calls to f() while pred() is true.
> And an elegant way to do this seems to be:
>
> (for [:while (pred)] (f))
>
> which doesn't work because (for) requires a binding.
> This can be worked around with:
>
> (for [i (constantly 0) :while (pred)] (f))
>
> which is not as elegant.
>
> Does anyone else think this is a worthwhile to "for"? Thanks for your
> opinions.
>  -Patrick
> >
>



-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to