(priority-map-keyfn-by keyfn comparator & keyvals)
Usage: (priority-map-keyfn-by keyfn comparator key val key val ...)
Returns a new priority map with custom keyfn, custom comparator, and optional supplied mappings.
The priority is determined by comparing (keyfn val).
(priority-map-keyfn-by keyfn comparator) yields an empty priority map with custom keyfn and comparator.
Source
(defn priority-map-keyfn-by
"Usage: (priority-map-keyfn-by keyfn comparator key val key val ...)
Returns a new priority map with custom keyfn, custom comparator, and optional supplied mappings.
The priority is determined by comparing (keyfn val).
(priority-map-keyfn-by keyfn comparator) yields an empty priority map with custom keyfn and comparator."
[keyfn comparator & keyvals]
{:pre [(even? (count keyvals))]}
(reduce conj (pm-empty-keyfn keyfn comparator) (partition 2 keyvals)))