I wonder why there is no function similar to
not-empty but for any value with any predicate, like:
(defn when-pred [v pred] (when (pred v) v))
I found this pattern very common and miss it in the core.
Are there reasons for not having it in the core?
1-arity is useful for wrapping predicates
(defn when-pred [pred] (fn [v] (when (pred v) v)))
(keep (when-pred pos?) xs)
The best name for such function which I found for now is