I'd like to return a hash-map like so:
(fn [foo bar] {:foo foo :bar bar})
Is it possible to do that without repeating the names? Something like how let
allows this:
(let [{:keys [foo bar]} args]
(...))
I'd like to return a hash-map like so:
(fn [foo bar] {:foo foo :bar bar})
Is it possible to do that without repeating the names? Something like how let
allows this:
(let [{:keys [foo bar]} args]
(...))
The macro:
(defmacro some-hash-thing [& vals]
(zipmap (map keyword vals) vals))
And in use:
(let [a 4, b 5]
(some-hash-thing b a))
;; => {:a 4, :b 5}
(defmacro as-keymap [& names] `(conj {} ~@(map (juxt keyword symbol) names)))