Clojure

multi arity into

Details

  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Trivial Trivial
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • 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"]])

Activity

Timothy Baldridge made changes -
Field Original Value New Value
Approval Vetted [ 10003 ]
Assignee Timothy Baldridge [ halgari ]
Hide
Timothy Baldridge added a comment -

Seems to be a valid enhancement. I can't see any issues we'd have with it. Vetted.

Show
Timothy Baldridge added a comment - Seems to be a valid enhancement. I can't see any issues we'd have with it. Vetted.
Timothy Baldridge made changes -
Affects Version/s Release 1.4 [ 10040 ]
Assignee Timothy Baldridge [ halgari ]
Timothy Baldridge made changes -
Assignee Timothy Baldridge [ halgari ]
Hide
Timothy Baldridge added a comment -

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.

Show
Timothy Baldridge added a comment - 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.
Timothy Baldridge made changes -
Patch Code and Test [ 10002 ]
Attachment multi-arity-into.diff [ 11726 ]
Timothy Baldridge made changes -
Assignee Timothy Baldridge [ halgari ]
Hide
Rich Hickey added a comment -

This is a good example of an idea for an enhancement I haven't approved, and thus is not yet vetted.

Show
Rich Hickey added a comment - This is a good example of an idea for an enhancement I haven't approved, and thus is not yet vetted.
Rich Hickey made changes -
Approval Vetted [ 10003 ]

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: