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

0 votes
in Docs by

The docstring of {{filterv}} prohibits using a filter predicate that has side effects:

bq. Returns a vector of the items in coll for which (pred item) returns logical true. pred must be free of side-effects.

The last statement seems unmotivated. {{filterv}} is based on reduce, and therefore eager like {{into}} or {{mapv}}. There is no obvious reason to forbid ('must'!) side effects in the predicate.

This docstring has caused confusion in the past. Examples:

The docstring was originally copied verbatim from lazy {{filter}} (CLJ-847, (link: https://github.com/clojure/clojure/commit/ec59ebac31d1d6722793f988685154c83232f964 text: commit ec59eba)), which could explain why the sentence is there in the first place.

Solution

Delete the sentence 'pred must be free of side-effects.' in the docstring.

1 Answer

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