Consider a function with the following signature:
(defn make-widget [& {:keys [x y] :or {x 10 y 20}}]
...)
What is the best way to pass a map to the function, e.g.:
(make-widget {:x 100})
or
(make-widget {:y 200 :x 0})
What I have currently thought of is via vec
, flatten
and apply
e.g.:
(apply make-widget (flatten (vec ({:x 100}))
I strongly believe there is a better way to do this. Can you please consider one?