Fork me on GitHub

FYI: a deploy token is now required to deploy to Clojars. See for details. Thanks!

clojars 3

Generated a token and updated my repository auth config then deployed an artifact. Works great, thanks for making things more secure!


My pleasure!


I've been using tokens for deploying several libs for a while now -- I was pleasantly surprised at how seamless the transition was!

Drew Verlee19:06:56

I'm reading through clojure the essential reference and it claims that (range 10) is a reducible collection. That a reducible collection is anything that implements the coll-fold protocol. How do i check this? hmm maybe it has a mistake and its CollFold?

(satisfies? clojure.core.reducers/coll-fold (range 10))
;; 1. Unhandled java.lang.NullPointerException
;; (No message)

(satisfies? clojure.core.reducers/CollFold (range 10))
;; => true


@drewverlee this is fresh in my mind because I just implemented CollFold for plan in next.jdbc 🙂

Drew Verlee19:06:09

Thanks. so i don't misquote. the book claims: > A "reducible" collection is a collection that provides reduce with a custom implementation. If the collection implements the coll-fold protocol, reduce delegates the iteration to the collection itself instead of using the generic mechanism. For example, (range 10) is a reducible (sequential) collection. r/map inc) (range 10 is also reducible collection although it does not exhibit other typical properties of a collection. Generically, isn't reduce just a subtype of fold? Left fold? I guess the specific context is more important, what's the disquisition in clojure?


The specific protocol CollFold is part of the reducers library, and implements a kind of parallel reduce


It takes advantage of the internal tree like structure of many of clojures immutable collections (vectors and maps) to do a divide and conquer parallel reduce


It isn't used a ton because reducers are largely superceded by transducers, the parallel reduce operation being the one thing you don't get with the transducer additions


coll-fold is definitely not a the name of the protocol


The protocol is CollFold and coll-fold is the only protocol function that is part of that protocol

Drew Verlee19:06:42

I see so CollReduce and CollFold overlaps with transdeucers in providing a seperation of concerns. But CollFold has parallelism and transdecuers are lazy?


Reducers are sort of an early iteration of the same idea as transducers: defining transformations of collections by transforming a function used to reduce the collection

💯 3

Transducers do this in a very direct style without introducing wrapping of collections


Reducers did introduce wrapping


As part of the work on reducers and transducers clojure grew some abstractions for collections that know how to reduce themselves


CollFold is more connected to those new specialized versions of reduce, then it is to the transformations of reducing functions


If something satisfied CollFold it knows how to reduce itself in parallel

Drew Verlee19:06:21

I see. That's similar to what the book is claiming to. Thanks for the clarification.