Is it possible to create a MapEntry from scratch?
Since Rich discouraged use of the MapEntry class, here are a couple of options.
First, one thing worth remembering is that vectors are functions of
their indexes, so you can do this and get rid of the "get"'s:
(map #(str "Key: " (% 0) "Value: " (% 1)) [[:a 3] [:b 2] [:a 1] [:c 0]])
Second, if it was the use of (key) and (val) that you were most
interested in, you could create your own (map-entry) function:
user=> (defn map-entry [k v] (first {k v}))
#'user/map-entry
user=> (map #(str "Key:" (key %) "Value:" (val %))
[(map-entry :a 3) (map-entry :b 2) (map-entry :a 1) (map-entry :c 0)])
("Key::aValue:3" "Key::bValue:2" "Key::aValue:1" "Key::cValue:0")
HTH,
- J.
user=> (defn map-entry [k v] (first {k v}))