Why does using keywords or symbols as functions to lookup values from maps work?

Citation from official documentation:

Keywords implement IFn for invoke() of one argument (a map) with an optional second argument (a default value). For example (:mykey my-hash-map :none) means the same as (get my-hash-map :mykey :none). See get.

And Clojure can call keyword as function, because it implements same interface as function. The same is for symbols…

Leave a Comment