https://clojure.org/news/2021/03/18/apis-serving-people-and-programs Clojure logo Clojure OverviewReferenceAPIReleasesGuidesCommunityDevNews [ ] [Search] Keyword argument functions now also accept maps Clojure 1.10.3 release Clojure 1.10.2 release State of Clojure 2021 Survey Cognitect Joins Nubank! Clojure Homebrew Tap State of Clojure 2020 Results State of Clojure 2020 Survey Clojure Forum Clojure 1.10.1 release JIRA Migration State of Clojure 2019 Results State of Clojure 2019 Survey Clojure 1.10 release State of Clojure 2018 Results Git Deps for Clojure Clojure 1.9 is now available State of Clojure 2016 Results Introducing clojure.spec State of Clojure 2015 survey results Clojure 1.8 is now available Welcome to the new clojure.org! Clojure 1.7 is now available Transducers are Coming Clojure core.async Channels Anatomy of a Reducer Reducers - A Library and Model for Collection Processing Clojure Governance and How It Got That Way Introducing ClojureScript Keyword argument functions now also accept maps Keyword argument functions now also accept maps 18 March 2021 Fogus To date, Clojure's support for keyword arguments forces programmers to choose between creating APIs that better support people (accepting keyword args) or APIs that better support programs (by taking a map of those args). Introduced in Clojure 1.11, a function specified to take keyword arguments may be passed a single map instead of or in addition to (and following) the key/value pairs. When a lone map is passed, it is used outright for destructuring, else a trailing map is added to the map built from the preceding key/values via conj. For example, a function that takes a sequence and optional keyword arguments and returns a vector containing the values is defined as: (defn destr [& {:keys [a b] :as opts}] [a b opts]) (destr :a 1) ->[1 nil {:a 1}] (destr {:a 1 :b 2}) ->[1 2 {:a 1 :b 2}] In Clojure 1.11 the call to destr accepts a mixture of key/value pairs and/or a lone (or trailing) map benefitting both programmer and program. This enhancement is available now in org.clojure/clojure "1.11.0-alpha1". Community Resources Contributing Companies Site Legal License Privacy Policy Documentation Overview Reference API Guides Libraries & Tools Updates News Events ETC ClojureTV Books Swag Code Releases Source ClojureScript ClojureCLR Copyright 2008-2021 Rich Hickey | Privacy Policy Logo & site design by Tom Hickey Published 2021-03-18 Update this page