if i have a vector of maps and i assoc that vector into 3 separate entries of a new map, the entries are only holding pointers to the heap-allocated vector of maps, right? until i actually update or change the vector (or any nested maps), there's no additional allocations?
Yes.
thank you
The more the merrier
In the latest 1.13.0 alpha is there a way to specify the exception thrown by :keys! ? Currently it's IllegalArgumentException on the first key missing, but I want to throw it specifying all the missing keys.
no, you should use :missing and do that yourself if needed
it's important to note here that there are two reasons keys may be missing: 1) your program is wrong (in which case, you probably want :keys! to learn this during development), or 2) your user passed incomplete data at runtime - better use case for :missing
I see, will look into it. Thanks!
1.13 opens up never seen before possibilities of truly expressing how you feel about your data.
$ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.13.0-alpha6"}}}' -J-Dclojure.spec.skip-macros=true
Clojure 1.13.0-alpha6
user=> (let [{:keys-i-like-very-much [foo bar baz] :keys-that-are-stupid-and-boring [x y z]} {:foo 1 :x 2}] [foo bar baz x y z])
[1 nil nil 2 nil nil]oh my god
disclaimer: this is all off spec
Just (s/def :clojure.core.spec.alpha/map-bindings any?) and it's "on spec" again. ;) What's a small spec override between two friends - you and Clojure.