Support for multiple key(s)-value pairs in assoc-in

Description

It would be nice if assoc-in supported multiple key(s)-to-value pairs (and threw an error when there were an even number of arguments, just like assoc):

Patch: clj-1771.patch

Prescreened by: Alex Miller

Environment

All

Activity

Show:
import
July 23, 2015, 8:15 PM

Simple patch attached. I did not find any existing tests for assoc-in but I could add them if wanted.

Yehonathan Sharvit
August 19, 2016, 4:19 PM

for the sake of symmetry with `assoc` I'd love to see this ticket fixed

Alex Miller
November 28, 2016, 4:33 AM

Do you need the "if kvs" check?

Should have tests.

Matthew Gilliard
January 14, 2017, 5:34 PM

Sorry for the delay - I don't get notifications from this JIRA for some reason.

The patch now includes tests.

Both `if` checks are necessary as we have 3 possible outcomes there:
1/ No more kvs (we are finished)
2/ More kvs (we need to recur)
3/ A sequence of keys but no value (throw IAE)

Assignee

Unassigned

Reporter

Griffin Smith

Labels

None

Approval

Vetted

Patch

Code and Test

Affects versions

Priority

Major