Actually it seems the oddity is that "next" now does the computation
instead of "first" in Iterate.java.

On Wed, Apr 1, 2015 at 8:56 PM, Ambrose Bonnaire-Sergeant <
abonnaireserge...@gmail.com> wrote:

> AFAICT there is consistently one extra call, which seems to suggest an
> off-by-one error in the IReduce implementation of Iterate.
>
> ;; 1.6
> user=> (take 11 (iterate (fn [a] (prn (str "PR" a)) (inc a)) 1))
> "PR1"
> "PR2"
> "PR3"
> "PR4"
> "PR5"
> "PR6"
> "PR7"
> "PR8"
> "PR9"
> "PR10"
> (1 2 3 4 5 6 7 8 9 10 ...)
>
> ;; 1.7.0-alpha6
> user=> (take 11 (iterate (fn [a] (prn (str "PR" a)) (inc a)) 1))
> "PR1"
> "PR2"
> "PR3"
> "PR4"
> "PR5"
> "PR6"
> "PR7"
> "PR8"
> "PR9"
> "PR10"
> "PR11"
> (1 2 3 4 5 6 7 8 9 10 ...)
>
> Thanks,
> Ambrose
>
> On Wed, Apr 1, 2015 at 8:50 PM, Matching Socks <phill.w...@gmail.com>
> wrote:
>
>> Ambrose, does that "iterate" result arise from chunking?  "iterate" is
>> advertised as producing an infinite lazy sequence.  While a suddenly
>> chunking "iterate" will no doubt smoke out some cases like this, doesn't it
>> seem that they are abuses?  It's not quite spot-on to employ "take" or
>> "take-while" outside the "iterate" as a loop-ending nanny for sequences
>> that could not genuinely be infinite.  The "take" should be concerned with
>> what the consumer wants to consume, not preoccupied with what the producer
>> will be able to produce.
>>
>> --
>> 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
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to