Abbreviation of constructs where you let vars and then want to create a map.
(let [a 1
b (inc a)]
{:a a
:b b}
(require '[dsann.let-map :refer [let-map])
(let-map
a 1
b (inc a)
...)
=> {:a 1 :b 2}
io.github.davesann/let-map {:git/tag "v8" :git/sha "c55f58b"}
if you want to list all versions
git show-ref --tags --abbrev
- clj
- cljs
- bb
- Names that start _ are removed from the final map
- Useful for intermediate values
- Destructuring works
- Refer to tests for examples: let-map tests
- since v8:
- The input map type will be retained when using assoc versions
- If you want to let-map a specific map type then
(let-assoc (my-map-type) a 1 ...)
- let-assoc:
- like let-map but add to a provided map
- sym-map:
- create a map from a list of symbols. Keys will be the symbol names
- assoc-syms
- like sym-map but add to a provided map
See namespace: dsann.let-map-test
if using clj-kondo and you are seeing unresolved-symbol errors
- Ensure there is a .clj-kondo in your project
- Then run the following command to copy configs to exclude these errors
clj-kondo --lint "$(clojure -Spath)" --copy-configs --skip-lint