Re: Change in reduce behavior in 1.3.0?

2011-07-13 Thread Sebastián Galkin
> At what point in time it realises the elements is mood in the end Yes. Probably the whole point of (finite) lazy seqs is some sort of side effect. Be it memory consumption, processing time, or other forms of side-effect. But, shouldn't map, filter, reduce and others, with its lazy-friendly be

Re: Change in reduce behavior in 1.3.0?

2011-07-13 Thread Meikel Brandmeyer
Hi, Am Mittwoch, 13. Juli 2011 16:15:28 UTC+2 schrieb Sebastián Galkin: > > > Making assumptions between the order of realization of seq elements and > calls to the reducing functions seems crazy to me, really. > > May be, but it's not as much about the order as about the laziness. New > reduce

Re: Change in reduce behavior in 1.3.0?

2011-07-13 Thread Sebastián Galkin
> Making assumptions between the order of realization of seq elements and calls to the reducing functions seems crazy to me, really. May be, but it's not as much about the order as about the laziness. New reduce is less lazy than previous, and maybe unnecessarily so. If you think of a collecti

Re: Change in reduce behavior in 1.3.0?

2011-07-13 Thread Laurent PETIT
2011/7/13 Sebastián Galkin > Oh I see it now, the call is inverted in 1.2.1 core.clj. Thanks, it was > driving me crazy. > > Regarding Meikel comment on clojure-dev > > > I will open a ticket to either apply the shown fix, or modify the > contract of reduce to require pureness of f. > > I think t

Re: Change in reduce behavior in 1.3.0?

2011-07-13 Thread Sebastián Galkin
Oh I see it now, the call is inverted in 1.2.1 core.clj. Thanks, it was driving me crazy. Regarding Meikel comment on clojure-dev > I will open a ticket to either apply the shown fix, or modify the contract of reduce to require pureness of f. I think that changing reduce contract, such a basic

Re: Change in reduce behavior in 1.3.0?

2011-07-13 Thread Meikel Brandmeyer
Hi, Am Mittwoch, 13. Juli 2011 11:02:40 UTC+2 schrieb bsmith.occs: > > On Wed, Jul 13, 2011 at 08:43, Meikel Brandmeyer wrote: > > Hi, > > > > I think the culprit is here: > > > https://github.com/clojure/clojure/blob/5f9d6a02c530a02251197e1b844af37440a6b569/src/clj/clojure/core/protocols.clj#L6

Re: Change in reduce behavior in 1.3.0?

2011-07-13 Thread Ben Smith-Mannschott
On Wed, Jul 13, 2011 at 08:43, Meikel Brandmeyer wrote: > Hi, > > I think the culprit is here: > https://github.com/clojure/clojure/blob/5f9d6a02c530a02251197e1b844af37440a6b569/src/clj/clojure/core/protocols.clj#L64 > > The line "(recur cls (next s) f (f val (first s)))" must be written as > > (l

Re: Change in reduce behavior in 1.3.0?

2011-07-12 Thread Meikel Brandmeyer
Hi, I think the culprit is here: https://github.com/clojure/clojure/blob/5f9d6a02c530a02251197e1b844af37440a6b569/src/clj/clojure/core/protocols.clj#L64 The line "(recur cls (next s) f (f val (first s)))" must be written as (let [v (f val (first s))] (recur cls (next s) f v)) for your scenar

Change in reduce behavior in 1.3.0?

2011-07-12 Thread Sebastián Galkin
I think I've found a change in the behavior of reduce function, passing from 1.2.1 to 1.3.0. Given the following: (defn lazy [] (lazy-seq (print "*") (cons :foo (lazy (defn show [] (reduce (fn [r x] (print "!")) [] (take 10 (lazy This is the output of a call to