On Tue, Sep 4, 2012 at 1:24 AM, Ben Wolfson <wolf...@gmail.com> wrote:
> On Mon, Sep 3, 2012 at 1:58 PM, Stephen Compall
> <stephen.comp...@gmail.com> wrote:
> Of course take-while might cause more of a lazy seq to be realized
> than is present in its output because of seq chunking. But I'd *hope*
> that it wouldn't exacerbate that by reserving the right to work like,
> say, this, where n is the largest number of elements of a seq calling
> first might compute:
>
> 1. Realize the first 1000n elements of a seq, retaining them in memory.
> 2. Call pred on those elements in reverse order.
> 3. If pred was true for all of them, realize the next 1000n elements,
> etc., otherwise return a lazy seq of the first stretch of elements for
> which pred returned true.
>
> That admittedly would be insane, but if pred is free of side-effects
> (and computing the elements of the collection is also free of
> side-effects) it would be correct.

It wouldn't even be all that insane if you had 1000 otherwise idle
cores sitting around and an expensive enough predicate.

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

Reply via email to