On Thu, Nov 5, 2009 at 7:03 PM, Daniel Janus <nath...@gmail.com> wrote:

> To avoid citing the entire README blurb, I'll just give you some
> examples:
>
>    (iter (for x in [31 41 59 26])
>          (for y from 1)
>          (collect (+ x y)))
>    ==> (32 43 62 30)
>
>    (iter (for s on [1 2 3 4 5])
>        (for q initially () then (cons (first s) q))
>        (collect (cons (first s) (concat (take 2 (rest s)) (take 2
> q)))))
>    ==> ((1 2 3) (2 3 4 1) (3 4 5 2 1) (4 5 3 2) (5 4 3))


I hate to be the party-pooper in this bunch, but what's the advantage over:

(map + [31 41 59 26] (iterate inc 1))

and

(let [s (take-while identity (iterate next [1 2 3 4 5]))]
  (map #(concat (cons (first %1) (concat (take 2 (rest %1)) (take 2 %2))))
    s
    (reductions #(cons (first %2) %1) () s)))

?

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