I'd love to see some example code for doing this.
I'm trying to implement it in Kotlin and am curious how it would compare.
I'm trying to implement it in Kotlin and am curious how it would compare.
(def mymap {"asd" 1 "qwe" 2 "rtz" 3 "foo" 4 "bar" 5 "quz" 6 "bnm" 7})
(let [ints (->> (filter (comp odd? count key) mymap)
(sort-by (comp int last first))
(map (fn [[s i]]
(+ (count s) i))))]
(reduce + 0 (map * ints (reverse ints))))
Gives me 341