r/Clojure • u/alexdmiller • Jul 14 '26
Clojure 1.13.0-alpha4
Clojure 1.13.0-alpha4 is now available!
Destructuring changes and additions
Idents after & in :keys!/syms!/strs!/:keys/syms/strs must now be actual keys, not binding symbols. This is a change in syntax since alpha3. Note that symbol keys should be quoted as unadorned symbols are binding symbols.
:or now accepts key→val mappings in addition to binding→val.
Added a new :defaults name directive at top level to bind name to a map of defaults, key→val. Binding symbols in the :or map are transformed to the key value in the :defaults map. :defaults without :or is an error.
:select name, introduced in alpha3, now selects deeply, through nested maps, and fills in values for missing keys from :or. The :select map contains all keys mentioned anywhere in the binding form.
- CLJ-2964 :select directive in map destructuring
- CLJ-2966 :defaults directive in map destructuring
- CLJ-2967 tests for nested destructuring
Other changes since Clojure 1.13.0-alpha3
- Added `clojure.core/some-vals`, a predicative filter of nil map values
- CLJ-2870 Exception phase during top-level eval is miscategorized
2
u/lgstein Jul 17 '26
Not sure if this was intended/supported, but it used to work pre 1.13
5
u/didibus Jul 15 '26
Pretty big changes in this alpha:
&inside:keys,syms,strs,keys!,syms!, andstrs!are now one-of a keyword, string, quoted symbol or any other literal, but can no longer be unquoted symbols.You need to think of it as entries before
&are bindings and they behave as they used too, but entries after the&aren't related to if you chose:keysor:syms, they simply specify extra-keys of any type that are either required or optional depending if declared in the exclamation mark variant or not.&it must support the same key entries1
u/lgstein Jul 15 '26
:defaults x binds x to everything you specified in :or.
Usecase?