Comment made by: vitoshka
This is a very common pattern for me.
This is one way of dealing with such state-dependent conditionals:
(-> x
(as-> y (if (:foo y) (assoc y :boo 0) y))
...)
The proposed condp->
is much more readable:
(-> x
(condp-> :foo (assoc :boo 0))
...)
BTW, condp->
is not exactly the counterpart of condp
. So maybe shorter pred->
or p->
are better names for this.