Created
March 8, 2021 11:33
-
-
Save mprokopov/93a581cdbafa1ed910afbfb44938a73e to your computer and use it in GitHub Desktop.
clojure namespaced keywords destructuring
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (require '[widget.factory :as factory]) | |
| ;; direct | |
| (fn [{clip :widget.factory/clip}] | |
| ) | |
| ;; :keys + symbol | |
| (fn [{:keys [widget.factory/clip]}] | |
| ) | |
| ;; :keys + keyword | |
| (fn [{:keys [:widget.factory/clip]}] | |
| ) | |
| ;; same but with "auto-resolved keyword" | |
| (fn [{:keys [::factory/clip]}] | |
| ) | |
| ;; namespaced ::keys | |
| (fn [{::factory/keys [clip]}] | |
| ) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
refactored into