Clojure

min-key assumes numbers, not comparables.

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Declined
  • Affects Version/s: Release 1.2, Release 1.3, Release 1.4, Release 1.5, Release 1.6
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code

Description

The min-key function assumes the key-fn will yield a number and thus uses the '<' operator to compare results.
There are cases where one might want to use min-key with comparables instead.

While (first (sort-by key-fn seq)) could also be used, it feels more natural for min-key to use comparables.

Activity

Hide
Pierre-Yves Ritschard added a comment -

As discussed on the .L, since compare is slower it makes more sense to keep min-key as-is.

Show
Pierre-Yves Ritschard added a comment - As discussed on the .L, since compare is slower it makes more sense to keep min-key as-is.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: