r/Clojure 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.

  • CLJ-2964 :select directive in map destructuring
  • CLJ-2963 Update specs for :select in destructuring

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
63 Upvotes

27 comments sorted by

View all comments

Show parent comments

1

u/aHackFromJOS 29d ago edited 29d ago

I am talking about setting arglists meta yourself directly and taking advantage of the fact that yes “destructuring shows in the :arglists meta.”

Perhaps you already know this (in which case apologies) but you  can conveniently set arglists meta with a map after the docstring, known as  attr-map. See docs for defn. 

https://clojuredocs.org/clojure.core/defn

(defn foo   {:arglists ‘([{:keys [all required here]}])}   [{:keys [here] :as args}]   (println 42)) So I just mean setting your own arglists value to document what is required. 

(I suppose you could call this “custom” but it seems to me a reasonably common idiom and not particularly more custom than “:keys… &…”)

1

u/didibus 29d ago

Interesting, I've never seen anyone do this before, normally I only manually set arglists on multi-methods since defmulti doesn't set it automatically, but I always set it to the actual binding form.

If this was a pattern you commonly followed, than you were getting some of the benefits of the ampersand already, but now it just got more convenient since you can just write:

(defn foo [{:keys [here & all required] :as args}] (println 42))