data.priority-map

(empty ...) forgets the comparator

Details

  • Type: Defect Defect
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code and Test

Description

The current implementation is:

(empty [this] pm-empty)

It should be:

(empty [this] (pm-empty-by (.comparator priority->set-of-items)))

This allows eg:

(into (empty pm) (filter f pm))

It also ensures that clojure.walk works correctly.

Activity

Hide
Andy Fingerhut added a comment -

Patch dprimap-6-v1.txt adds tests to verify that empty preserves not only the comparator, but also the metadata of the priority map. empty preserves the metadata of all other Clojure collections for which it is implemented.

It also modifies empty to pass these new tests.

Show
Andy Fingerhut added a comment - Patch dprimap-6-v1.txt adds tests to verify that empty preserves not only the comparator, but also the metadata of the priority map. empty preserves the metadata of all other Clojure collections for which it is implemented. It also modifies empty to pass these new tests.
Hide
Andy Fingerhut added a comment -

Mark Engelberg independently discovered and fixed this issue some time ago.

Show
Andy Fingerhut added a comment - Mark Engelberg independently discovered and fixed this issue some time ago.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: