Make conj assoc dissoc and transient versions handle args similarly


Examples that work as expected:

Examples that do not work as desired, but are changed by the proposed patch:

I looked through the rest of the code for similar cases, and found that there were some other differences between them in how different numbers of arguments were handled, such as:

+ conj handles an arbitrary number of arguments, but conj! does not.
+ assoc checks for a final key with no value specified (CLJ-1052), but assoc! did not.

History/discussion: A discussion came up in the Clojure Google group about conj giving an error when taking only a coll as an argument, as opposed to disj which works for this case:!topic/clojure/Z9mFxsTYTqQ

Screened by: Alex Miller




Michael Blume
October 12, 2015, 11:32 PM

Updated patch to apply cleanly to master

Michael Blume
October 6, 2017, 10:16 PM

Updated patch

Andy Fingerhut
October 7, 2017, 12:00 AM

Is it intentional that clj-1103-9.patch leaves out the changes to assoc! that were in the earlier patches? I can create another updated one if so – just curious if there was a reason for the change.

Michael Blume
October 7, 2017, 1:17 AM

That was not intentional at all, thanks for catching it, I'm honestly not sure what happened on my end to make that happen. I think this patch should be a correct update. Sorry about that.

Andy Fingerhut
October 10, 2017, 4:17 AM

No worries, and I thank you for keeping the patch current, even while keeping my name on it.


Alex Miller


Andy Fingerhut




Code and Test

Affects versions