[CLJ-1115] multi arity into Created: 25/Nov/12 Updated: 09/Dec/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Trivial |
| Reporter: | Yongqian Li | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
Any reason why into isn't multi arity? (into to & froms) => (reduce into to froms) (into #{} [3 3 4] [2 1] ["a"]) looks better than (reduce into #{} [[3 3 4] [2 1] ["a"]]) |
| Comments |
| Comment by Timothy Baldridge [ 27/Nov/12 11:25 AM ] |
|
Seems to be a valid enhancement. I can't see any issues we'd have with it. Vetted. |
| Comment by Timothy Baldridge [ 29/Nov/12 2:06 PM ] |
|
Added patch & test. This patch retains the old performance characteristics of into in the case that there is only one collection argument. For example: (into [] [1 2 3]) . Since the multi-arity version will be slightly slower, I opted to provide it as a second body instead of unifying both into a single body. If someone has a problem with this, I can rewrite the patch. At least this way, into won't get slower. |
| Comment by Rich Hickey [ 09/Dec/12 7:39 AM ] |
|
This is a good example of an idea for an enhancement I haven't approved, and thus is not yet vetted. |