Proposal: lists:reject/2

I’m using lists:filter/2, and my predicate has a number of clauses. Then I want to invert the sense of the predicate.

Elixir’s got Enum.reject/2. Would Erlang be improved by having the same?

Alternatives considered; I like neither:

  • lists:partition/2 in both cases – can just match the other element in the tuple.
  • Adding a local invert (or similar) function to wrap the predicate, reversing the sense.
3 Likes

Well, that was simpler than I expected: Add lists:reject/2 by rlipscombe · Pull Request #10692 · erlang/otp · GitHub

2 Likes