The 1-argument form of a reducing function is called at the end of the
reduce. So for example:

(defn mean
  "Transducer that returns the mean average."
  ([] [0 0])
  ([[sum count]]
   (/ sum count))
  ([[sum count] value]
   [(+ sum value) (inc count))


On Fri, 25 Jan 2019 at 22:19, Brian Craft <craft.br...@gmail.com> wrote:

> The transducers doc suggests transduce works with standard reducing
> functions, but then transduce makes a one-argument call to the function.
>
> The code docs for transduce say the reducing function must support a
> one-argument call, but don't give any information about what that call
> should do.
>
> It could be helpful to document this requirement, especially since the
> examples are all written with "+", which is rather misleading since it's
> not a standard reducing function with respect to its arity, and there is
> this unusual requirement on the arity of the function.
>
> --
> 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.
>


-- 
James Reeves
booleanknot.com

-- 
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