Reputation: 819
I am reading an open source project and trying to understand this function which is defined in a let statement:
handler (fn [{:keys [type request-id] :as msg}]
...
)
Specifically, the argument list. What is {:keys [type request-id] :as msg}
called, and what does it do?
Upvotes: 1
Views: 106
Reputation: 10632
It's called destructuring.
This particular case is analogous to
(fn [msg]
(let [type (get msg :type)
request-id (get msg :request-id)]
...))
Upvotes: 4