On Sat, Dec 6, 2008 at 4:27 AM, Christophe Grand <[EMAIL PROTECTED]> wrote:
>
> But I don't think it's still O(n). I searched for a way to define
> recursively such lists but the only way I found involves using mutation.
> Now with an atom it must be cleaner.

Your comprehension of such things is clearly deeper than mine.
Testing just now on large collections, the version using 'map' is
indeed not only slower, but also overflows the stack.  Hm... and
perhaps I see why now.  Is it computing the entire chain up to each
result -- O(n^2), demanding n stack frames for the nth result?

Anyway, either of the definitions presented together work fine for
large collections and appear to operate in O(n) as you'd expect.

--Chouser

--~--~---------~--~----~------------~-------~--~----~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to