Welcome! Please see the About page for a little more info on how this works.

0 votes
in Docs by
The following code works, but it is unspecified in the docs whether `(inc a)` can rely on `a` being bound.


user=> (defn foo [a {:keys [b] :or {b (inc a)}}]
  [a b])
user=> (foo 1 {:b 99})
[1 99] ;; :or not needed
user=> (foo 1 {})
[1 2]  ;; :or binds b to (inc a)


In sequential destructuring, are bindings bound in order such that subsequent :or value expressions can rely on prior sequential bindings?

This is true based on the current implementation of destructure, but looking for a statement to this effect in the docs and/or tests.

1 Answer

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-1881 (reported by alexmiller)
...