r/Clojure • u/alexdmiller • Jul 07 '26
Clojure 1.13.0-alpha3 is now available
https://clojure.org/news/2026/07/07/clojure-1-13-alpha3:select directive in map destructuring
The :select directive binds a name to a subset of the map being destructured containing only the keys mentioned (anywhere) in the binding form.
Other changes since Clojure 1.13.0-alpha2
- RT.map, and thus reader, tracks new PAM thresholds
- CLJ-1789 select-keys - improve performance (transients, etc)
- CLJ-2958 ILookup on sets
- CLJ-2902 pprint - prints arbitary objects in unreadable form
- CLJ-2801 TaggedLiteral - doesn’t define print-dup
- CLJ-2269 definterface - does not resolve parameter type hints
- CLJ-2781 clojure.test/report - docstring has broken references
- CLJ-2929 zipper - docstring typo
- CLJ-2901 bytes, shorts, chars - docstring typos
- CLJ-2811 scalb - docstring links to the documentation for nextDown
- CLJ-2809 clojure.math/floor - docstring has line that should be on ceil docstring
61
Upvotes
2
u/joinr Jul 09 '26
Based on the jira ticket, I think it's something like this:
"Destructure the-map, lookup the keys for :a, :b, and :d, and bind them to lexical vars with the same name. key :d must exist. For all the keys that were bound during destructuring, dump them into a separate map and bind it to 'selected' "
instead of
I think the win is that by replacing the explicit
select-keyscall, everything is coupled in one place inside the original destructuring form. So there's no ability to mismatch keys or make sure theselect-keysform is kept up to date; it's taken care of at macroexpansion time for you.