2 ms·
>>It may be that bad comments tend to be concentrated on particular threads, and that the right way to implement pending comments is per-thread rather than site
by jw2013 13y ago
>>It may be that bad comments tend to be concentrated on particular threads, and that the right way to implement pending comments is per-thread rather than site-wide.
So what about this? Here comments is a vector of all the scores of comments inside one particular thread.
----
(defn filter? [comments threshold]
(let [size (count comments)]
(if (< threshold (/ (reduce + comments) size)) false
true)))
;;user=> (filter? [1 2 3 4] 2)
;;false
;;user=> (filter? [1 2 3 4] 3)
;;true