Hi,

On Aug 10, 3:13 pm, Laurent PETIT <laurent.pe...@gmail.com> wrote:

> next is more eager than rest, but in a loop scenario, I generally use next
> since we'll test for nil in order to know whether to continue to iterate or
> not.

I generally use next when I know that I need to realise anyway soon.
As Laurent said: this happens a lot in loop. Would we use rest, we
would have to check with seq whether the sequence is exhausted. If we
do this anyway, we can just as well use next and save the seq call.

Another such scenario is when you need a look-ahead in a lazy
sequence. Eg. partition-by needs at least one item look-ahead in order
to decide whether to split groups or not. Then you can also use next
since you realise the next step of the input sequence anyway.

Sincerely
Meikel

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