(cond-> {:is-valid true :foo "foo"} (:is-valid this) (assoc :bar "bar"))
; Syntax error compiling at (REPL:1:31).
; Unable to resolve symbol: this in this context
Please advise is the output itself bound into some symbol (like this in my example) so I can use it?
Is there a ask.clojure.org issue about including a similar macro in core? I feel it comes up very often on the slack and forums, just as much as update-vals does, at least in my unscientific observation.
As an experience report, I will say that we have less than 30 uses of condp-> (in 119K lines of Clojure) and zero uses of condp->>. Compare that with 385 uses of the built-in cond-> and 17 uses of cond->>. We are less enamored with condp-> in practice than we thought we’d be – so I suspect it’s much less requested than you might think
We have 39 uses of as-> in that codebase too. We use some-> and some->> a lot more than even the built-in cond-arrows: 447 uses of some-> and 43 uses of some->>.
I wonder how many times you’ve used let where you would normally use ->/cond-> because a single output from a single function needed destructuring.
Threading macros are great when the use case is simple enough but let gives ultimate flexibility and in my opinion easier readability/maintainability for more complicated use cases.