Hi Daniel,
I too like the iter macro so much that I've written my own version for clojure (http://github.com/hoeck/clojurebox2d/blob/master/hoeck/ iterate.clj :). I use it to make it easier to work with the JBox2D physics engine, which is a a Java port from Box2D (written in C++) and thus often uses C++ Idioms like plain Objects with .getNext to traverse a list and more arrays than iterators. Also, traversing an array and picking/collecting/modifying some of its contents is way simpler in an iter clause than writing a clojure loop. So, I'm not really using it as a replacement for map, filter, reduce and friends, but as a more convenient replacement to loop/recur and areduce. Maybe, if there is some interest in it, we could make a unified iterate implementation? Erik On 6 Nov., 01:03, Daniel Janus <nath...@gmail.com> wrote: > Dear all, > > I am happy to announce the public availability of clj-iter, an Iterate- > like iteration macro. It is free (available under the terms of MIT > license) and can be found on GitHub:http://github.com/nathell/clj-iter > > The design goal was to keep it as simple as possible, and make it > blend well with the rest of Clojure. In > contrast to cl-loop, which uses mutable bindings, clj-iter has a > functional flavour, and macroexpands to the kind of code you would > write manually using loop/recur. It is also very simple, having a > fraction of Iterate's functionality, but I hope even the little there > is will be sufficient in many cases. > > 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)) > > Please let me know whether it is of any use to you. Feedback, and > especially patches, are more than welcome. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---