Comment made by: nberger
bq. We talked about maybe treating nil as a flag for not labelling in collect, but I don't particularly like that idea I don't think.
Perhaps we can use a namespaced keyword to signal that a label should be ignored? Something like {{clojure.test.check.stats/ignore}}. This way we can easily implement {{classify}} in terms of collect by creating a function that returns {{stats/ignore}} when pred doesn't match:
`
(defn collect
[prop label-fn]
(gen/fmap
(fn [{:keys [args] :as result-map}]
(let [label (apply label-fn args)]
(if (= ::ignore label)
result-map
(update result-map :labels conj label))))
prop))
(defn classify
[prop pred label]
(collect prop (fn [& args]
(if (apply pred args)
label
::ignore))))
`
Another option could be to add an extra arity in {{collect}}, to receive a flag about whether nil should be treated as a label or if it should be ignored. I like {{:stats/ignore}} more