It seems to have the same signature, so as a consumer of the library
it's the same to me.  If the speedup holds, I say make the change to
your version.

The only warning is that I couldn't find any regression tests for seq-
utils.  Perhaps this is a chance to add some.

My $.02

Sean

On Aug 6, 4:09 pm, Stuart Halloway <stuart.hallo...@gmail.com> wrote:
> Is the following an improvement on clojure.contrib.seq-utils/
> reductions, or a step backwards?
>
> (defn my-reductions
>    ([f coll]
>       (if (seq coll)
>         (cons (first coll) (my-reductions f (first coll) (rest coll)))
>         (cons (f) nil)))
>    ([f acc coll]
>       (if (seq coll)
>         (let [nextval (f acc (first coll))]
>           (lazy-seq (cons nextval (my-reductions f nextval (rest  
> coll))))))))
>
> On the plus side, it appears to be faster (as collections grow large),  
> and it doesn't "cheat" by introducing an atom. On the minus side it  
> isn't as pretty as the one in contrib.
>
> Stu
--~--~---------~--~----~------------~-------~--~----~
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