How to construct a map conditionally in #clojure? For example, embed a key-value pair only when a condition is met, literally like `{:bar 2 (when true :baz 3])}`.
Any ideas?
Here is what I come up with: `(apply hash-map :foo 1 :bar 2 (if true [:baz 3]))`
Any ideas?
Here is what I come up with: `(apply hash-map :foo 1 :bar 2 (if true [:baz 3]))`
Comments
(NB: Not a single-shot creation, but maybe that's not a concern)