I'm new to clojure and I'm trying to understand as much as possible but the documentations are so vague
when you have a function
(fn [_ {:keys [kind]}] kind)
my understanding is that the function takes a vector map but only wants access to a key as specified by the second param {:keys..... correct?
Then how many parameters do I pass to this function? 1 or 2?
is it a vector? {:kind 1 :dog 2} or the vector key value (:kind {....})?
It's fairly straightforward to see what a given function syntax does by trying it in the repl.
the
{:keys []}destructuring syntax is described pretty comprehensively in the official docs, and describes a shorthand to bind values that come from a hashmap. In Clojure{}is a hashmap, and[]is a vector, and these are not interchangeable.(:foo m)invokesgetto look up the value under the key:fooinm.(let [{:keys [foo]} {:foo "bar"}] ...)and(let [foo (:foo {:foo "bar"})] ...)are equivalent.