As I understand it, map is, itself, lazy. Does that mean that using map to implement these methods would create extra intermediate structures?
What if often used functions such as map/reduce/filter were macros, that could 'deforest' (to use Haskell terminology) these intermediate structures? Implementing all these functions on top of each other wouldn't create any extra overhead then. Regarding the design of clojure.core, if it was split among separate libraries, then someone could re-write the whole seq library differently to see if new ideas make sense. Given that clojure is still a new language, I would think such experimentation would be beneficial to the whole ecosystem. I was specifically thinking of Streams, which Rich discussed earlier. It looks like that project hasn't moved forward, but an isolated Seq library would have made it easier for newbies like myself to experiment with other Seq like structures. I know there is nothing stopping any one from experimenting now, but a smaller library would have encouraged quick prototypes. On Apr 18, 11:43 pm, Richard Newman <holyg...@gmail.com> wrote: > > Something like the 'for' macro (if it is thought of as a non-general > > monad) can be implemented in terms of reduce. Is there a reason > > this isn't so? > > I can think of two: > > * filter and map are lazy. Implementing every? and some? in those > terms would needlessly introduce lazy sequences to the mix. That > introduces a tiny amount of additional cost, and... > > * core does some ugly things (redefinitions, avoiding the use of some > functions because they haven't been defined yet, writing things in > Java, etc. etc.) for the sake of speed, because core is used > *everywhere*. It's not necessarily a manual for good Clojure style > unless you understand which constraints apply. > > -- > 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 > athttp://groups.google.com/group/clojure?hl=en -- 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