clojure-dev

Issues: https://clojure.atlassian.net/browse/CLJ | Guide: https://insideclojure.org/2015/05/01/contributing-clojure/
2020-01-02T04:47:28.083400Z

Is there some good write up somewhere of how reduce is internally implemented in Clojure? Or a summary at least of why there are interface IReduce, IReduceInit, and also CollReduce and InternalReduce? Even just a few sentences summarizing why these all exist might be clarifying.

alexmiller 2020-01-02T05:00:38.083700Z

CollReduce is the main protocol

alexmiller 2020-01-02T05:01:11.084400Z

IReduce/IReduceInit are Java interfaces that allow you to hook into the reduce protocol if you are directly implementing them

alexmiller 2020-01-02T05:01:26.084800Z

InternalReduce is implementation details

alexmiller 2020-01-02T05:02:48.086300Z

if you're writing a concrete Clojure thing, extend CollReduce. if you're writing some kind of low level Java thing like a data structure that you want to be reducible, implement IReduceInit at least, or IReduce if you want

2020-01-02T06:34:24.087200Z

Do you have an example of a concrete Clojure thing that should extend CollReduce, that is not some kind of low level Java thing? e.g. is a Clojure deftype class such a thing that should extend CollReduce?

alexmiller 2020-01-02T14:00:27.087700Z

sure

alexmiller 2020-01-02T14:01:08.088100Z

things like custom map impls for example