So, out of curiosity; what would be an example (by using transduce / sequence / iteration / core.async/chan etc) that would print "zero arity"?
-Gijs
Ghadi Shayban
unread,
Sep 16, 2014, 1:48:51 PM9/16/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to clo...@googlegroups.com
Call 'transduce without an init value, and it will use the 0-arity return as init. Same for reduce but in different scenarios (some IReduce/CollReduce collections)
Gijs S.
unread,
Sep 16, 2014, 2:11:38 PM9/16/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to clo...@googlegroups.com
No init value given with transduce uses the zero arity value of f rather than the zero arity of the reducing function through xform:
With Clojure 1.7.0-alpha2: user=> (doc transduce) ------------------------- clojure.core/transduce ([xform f coll] [xform f init coll]) reduce with a transformation of f (xf). If init is not supplied, (f) will be called to produce it. user=> (transduce println-transducing-fn + [1 2]) two arity two arity one arity 3 user=> (transduce println-transducing-fn + []) one arity 0
Ghadi Shayban
unread,
Sep 16, 2014, 2:39:26 PM9/16/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to clo...@googlegroups.com
I was sloppy with details. A reducing function like f may be transformed though by a transducer (a priori), and a transducer must preserve the contract.