在clojure中获取具有最大值的哈希元素

Ser*_*gey 4 clojure hashmap

如何在clojure hashmap中找到最大值元素?假设有以下hashmap:

{:a 1 :b 3 :c 4 :d 18 :e 9}
Run Code Online (Sandbox Code Playgroud)

在这种情况下,我们需要:d作为结果.

mob*_*yte 12

我想这是你的解决方案

(key (apply max-key val {:a 1 :b 3 :c 4 :d 18 :e 9}))
-> :d
Run Code Online (Sandbox Code Playgroud)