transducer arities for map-indexed, distinct, and interpose


  • with generative tests

  • with examples demonstrating performance

Performance: Details in comments, summary:

Patch: clj-1601-4.patch

Screening note: We could use transients to improve performance of the distinct impl, except checking containment in a transient set is broken per (which is not currently in 1.7). I have a new patch and direction on that could provide a way to solve that if we want to move it back and push this further. Or we could just wait and refactor when does go in.

Screened by:




Alex Miller
January 9, 2015, 4:33 PM

Ha, didn't see your comment Michael! I was working on the same thing.

Alex Miller
January 9, 2015, 4:27 PM

Updated tests to apply cleanly to current master in -4 patch.

Michael Blume
January 9, 2015, 4:23 PM

1601-3 no longer applies cleanly to master, I've got a reroll that does, is it ok to attach it even though the ticket is marked 'screened'?

Alex Miller
December 22, 2014, 2:32 PM

Hey Nikita, I'd rather fix and use the normal functions rather than what you've done in the patch, which is why I hadn't done this before. I'm waiting to check with Rich whether we'll do that in 1.7 or wait till next release.

Nikita Prokopov
December 21, 2014, 12:13 PM

This can be further improved by using transient set instead of persistent one in distinct:

Only caveat is that transient sets do not support contains? for now (see CLJ-700). This can be solved by using (.contains ^clojure.lang.ITransientSet set key)

I’m not sure what’s the best way to attach patch to this, for now attaching a patch that can be applied on top of Alex changes (clj-1601-transient-distinct.patch).

Your pinned fields
Click on the next to a field label to start pinning.


Alex Miller


Stuart Halloway





Code and Test



Fix versions