reduce returns a single value; there's no collection to make lazy. There is reductions, which returns the intermediate results of reduce as a lazy sequence.
Justin On Sep 6, 12:49 pm, Robert McIntyre <[email protected]> wrote: > I thought that since into uses reduce, it would be lazy, but I was wrong. > reduce just plows through everything with a non-lazy recursion. > > Why is reduce not lazy? > > --Robert McIntyre > > On Mon, Sep 6, 2010 at 12:37 PM, Michał Marczyk > > > > <[email protected]> wrote: > > On 6 September 2010 18:29, Robert McIntyre <[email protected]> wrote: > >> walk is good but it's not lazy. If you want to preserve laziness you can > >> do: > > > This won't be lazy, because (into {} ...) is a strict operation. > > > I'd suggest something like > > > (defn mmap [f m] > > (zipmap (keys m) (map f (vals m)))) > > > f is expected to care about the value only. > > > Sincerely, > > Michał > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to [email protected] > > Note that posts from new members are moderated - please be patient with > > your first post. > > 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 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. 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
