Welcome! Please see the About page for a little more info on how this works.

0 votes
in Clojure by

Zero-arity versions of these fns are useful in situations like the following:

;; compute-preds-for may return zero or many predicate fns (let [preds (compute-preds-for something)] (filter (apply every-pred preds) some-coll))

Approach: This patch adds zero-arity versions of every-pred and some-fn with these semantics:

(every-pred) === (constantly true) (some-fn) === (constantly nil)

Patch: 0001-Add-zero-arity-variants-for-every-pred-and-some-fn.patch
- Patch adds zero-arity version
- Patch reformats docstring to 80 character width (matching other core fns) - comments are identical other than the addition of a final sentence stating behavior with zero-arity.

Screened by:

6 Answers

0 votes
by

Comment made by: tsdh

This is the thread where Max Penet suggested to have 0-arity versions of the two fns:

https://groups.google.com/forum/?fromgroups=#!topic/clojure/IRlN-4LH_U0

0 votes
by

Comment made by: alexmiller

Tassilo, can you undo the line break changes on this patch to minimize the patch differences?

0 votes
by

Comment made by: tsdh

Rebased patch.

0 votes
by

Comment made by: tsdh

@Alex: That I've reformatted the docstring so that it doesn't look like a comb and fits in 80 columns is a feature. Should I really revert to the original, ugly, less readable formatting only to make the patch 8 lines shorter?

0 votes
by

Comment made by: alexmiller

My goal was to simplify the patch so it is easier to review. Since the comment is identical (except for the last line), we can instead note that as a feature of the patch.

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-1094 (reported by tsdh)
...