In my local Clojure Users Group last week, we encountered an odd behavior 
with r/fold.

Specifically, it seems like the three-arity version (r/fold combiner-fn 
reducer-fn coll) doesn't call the combiner-fn if the coll has fewer 
elements than the default partition-size (512).

This leads to some surprising behavior. For instance, Example 8 in this 
(written by someone else, and otherwise very nice) set of reducer examples 
will not calculate the average-age as desired, since the combiner-fn will 
not be called for a collection of just 100 
elements: https://gist.github.com/ianrumford/6333358

I realize that for a combiner-fn with just zero-arity or two-arity versions 
defined, calling it on a single partition would not make sense. Perhaps 
r/fold should be revised so that if a combiner-fn is provided that has a 
single-arity version defined, it still gets called even if there is just 
one partition? 

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to