Uploaded image for project: 'Clojure'
  1. CLJ-2247

{min,max}-key return first match in >= 1.9.0-alpha20, used to return the last one

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Completed
    • Affects versions: Release 1.9
    • Fix versions: Release 1.9
    • Labels:
    • Approval:
      Ok
    • Patch:
      Code

      Description

      The CLJ-99 Closed fix, first included in 1.9.0-alpha20, changes behaviour of min-key and max-key to return the first argument among those with the minimum/maximum key, whereas in previously they both returned the last matching argument:

      Clojure 1.9.0-alpha19
      user=> (apply min-key :x [{:x 1000} {:x 1001} {:x 1002} {:x 1000 :second true}])
      {:x 1000, :second true}
      
      Clojure 1.9.0-beta1
      user=> (apply min-key :x [{:x 1000} {:x 1001} {:x 1002} {:x 1000 :second true}])
      {:x 1000}
      

      Arguably the new behaviour is more natural, however this is a regression from prior behavior.

      Proposed: Restore the original behavior and update docstring.
      Patch: 0002-CLJ-2247-document-last-match-semantics-of-min-max-ke.patch
      Screened by: Alex Miller

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              michalmarczyk Michał Marczyk
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: