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

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.
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.
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.
Hide
Yongqian Li added a comment -

What's the plan for this bug?

Show
Yongqian Li added a comment - What's the plan for this bug?
Hide
Alex Miller added a comment -

@Yongqian This ticket is one of several hundred open enhancements right now. It is hard to predict when it will be considered. Voting (or encouraging others to vote) on an issue will raise it's priority. The list at http://dev.clojure.org/display/community/Screening+Tickets indicates how we prioritize triage.

Show
Alex Miller added a comment - @Yongqian This ticket is one of several hundred open enhancements right now. It is hard to predict when it will be considered. Voting (or encouraging others to vote) on an issue will raise it's priority. The list at http://dev.clojure.org/display/community/Screening+Tickets indicates how we prioritize triage.
Hide
Andy Fingerhut added a comment -

Patch multi-arity-into.diff dated Nov 29 2012 no longer applied cleanly to latest Clojure master due to commits made earlier today. Those changes add another arity to the function clojure.core/into, so the multi-arity generalization of into seems unlikely to be compatible with those changes.

Show
Andy Fingerhut added a comment - Patch multi-arity-into.diff dated Nov 29 2012 no longer applied cleanly to latest Clojure master due to commits made earlier today. Those changes add another arity to the function clojure.core/into, so the multi-arity generalization of into seems unlikely to be compatible with those changes.

People

Vote (1)
Watch (2)

Dates

  • Created:
    Updated: