On Sat, Dec 13, 2008 at 5:51 AM, Rich Hickey <richhic...@gmail.com> wrote: > No you can't, for the same reasons you can't for Iterator or > Enumeration seqs. Again it comes down to abstractions, and the > abstraction for (seq x) is one on persistent collections. It presumes > that (seq x) is referentially transparent, which it isn't for > ephemeral sources - i.e. streams aren't colls. It would become quite > fragile if people had to adopt call-once-only semantics for seq - > ephemerality would pollute the world. That said, there are a growing > number of these ephemeral-source-seq functions which could be folded > into one multimethod.
Okay, so you've got one abstraction (seq) for persistent collections (and therefore caches to guarantee persistence), and one abstraction (streams) that is for ephemeral sources, and you want to build a barrier between them (so the user has to explicitly call seq-stream to make the conversion). But don't forget that there are collections which are persistent (and therefore, it would be intuitive to use the first/rest sequence abstraction with them), yet too big to cache (e.g., sequence of all permutations of an 11 item list), and/or so cheap to compute that it makes no sense to cache (e.g., (range 100)). I am particularly interested to see what happens with these "persistent streams" for which a sequence abstraction DOES make sense. Perhaps one avenue is to annotate certain streams as being from non-ephemeral sources, and therefore they can automatically be passed to seq-based functions, and remain uncached through various transformations like rest/map/filter/etc. --~--~---------~--~----~------------~-------~--~----~ 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 clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---