The first thing that (= true (something)) can be replaced simply (something) without problems (unless you are actually trying to distinguish between the return value true and the return value, say 1 ). If the return parameters are true and false , (something) by itself will work fine. You can also use merging instead of in, which may be a little clearer.
You can try
(bar (if (something) (merge opts {:ab}) opts))
This would also work, although it requires an unnecessary call to merge when (something) is false, although with nil for the second argument, merge should return very quickly.
(bar (merge opts (when (something) {:ab})))
source share