Allow map-indexed to accept multiple collections (a la map)

Description

Bring external interface of map-indexed in line with map. Existing usages of map-indexed unchanged both in implementation and interface.

examples

(map vector (range 10 20) (range 30 35)) ;=> ([10 30] [11 31] [12 32] [13 33] [14 34]) (map-indexed vector (range 10 20) (range 30 35)) ;=> ([0 10 30] [1 11 31] [2 12 32] [3 13 33] [4 14 34])

Patch: CLJ-1601 map-indexed and tests 8-5-2017.patch - also adds tests for map-indexed

Prescreened by: Alex Miller

Environment

None

Attachments

3
  • 06 Aug 2017, 01:37 AM
  • 26 Oct 2012, 02:05 AM
  • 25 Oct 2012, 10:30 PM

Activity

Show:

Alex Miller November 29, 2018 at 6:19 PM

Yes, separate ticket for those would be good. I don’t know of one in existence yet.

Justin Spedding November 29, 2018 at 6:16 PM

It occurs to me that `keep` and `keep-indexed` also do not accept multiple collections. Perhaps I should make a similar ticket for updating those.

Alex Miller October 4, 2017 at 8:37 PM

I don't think we'll consider any more enhancements in 1.9 timeframe.

Justin Spedding October 4, 2017 at 5:37 PM

It's been a little while since I uploaded the patch here and it was prescreened. Both this ticket and another that I created are awaiting vetting, and the FAQ says that I should tend to my tickets. Is there something else that I should be doing to tend to it and move it along?

Justin Spedding August 6, 2017 at 1:40 AM

I just uploaded a new patch for map-indexed that allows it to accept multiple collections. I took the exact same approach that map does, but with the addition of the index. It has better performance than the old patch from 2012. I also included more tests. Both the function update and the new tests are in "CLJ-1601 map-indexed and tests 8-5-2017.patch"

Also, map-indexed had 0 tests prior to me writing the patch. That seems a bit dangerous for a function in core to be untested.

Details

Assignee

Reporter

Approval

Vetted

Patch

Code and Test

Priority

Created October 25, 2012 at 10:30 PM
Updated March 13, 2023 at 3:22 PM