Enum Reject vs Filter
If you're anything like me, you regularly forget if Enum.filter/2
keeps elements that return true or filters them out.
Let existence of Enum.reject/2
be your reminder.
reject/2
does the same thing as filter/2
but discards truthy elements instead of keeping them. I wish that filter/2
was renamed to keep/2
, then the 2 functions would feel more like logical opposites and perhaps more readable.