1 of 14

Array.p.select/reject

for Stage 1

2 of 14

Array.p.filter is terribly named*

It does the wrong thing.

*Personal opinions are my own

3 of 14

“Filtering”

  • To filter, filtering, filtered
  • To remove, removing, removed

“to remove by means of a filter”, from an actual dictionary

4 of 14

What does filter do to the current item?

Meaning what does filter do when the predicate returns true:

  • If it removes the item, it’s “filtering out”
  • If it keeps the item, it’s “filtering in”

5 of 14

What does filter do to the current item?

Meaning what does filter do when the predicate returns true:

  • If it removes the item, it’s “filtering out”
  • If it keeps the item, it’s “filtering in”

6 of 14

What does filter do to the current item?

Meaning what does filter do when the predicate returns true:

  • If it removes the item, it’s “filtering out” (╯°□°)╯︵ ┻━┻
  • If it keeps the item, it’s “filtering in”

7 of 14

Array.p.filter confuses me

every time

8 of 14

Array.p.select

  • Array.p.select fixes this confusion.
  • If you return true, you are selecting the current item

9 of 14

Array.p.reject

  • To allow the inverse without complicating the predicate
  • If you return true, you are rejecting the current item

10 of 14

Why “select” and “reject”?

They make sense.

Precedence from Underscore/Lodash

11 of 14

We even knew it when writing Array.p.filter’s spec text, 7.c.ii and 7.c.iii

12 of 14

We even knew it when writing Array.p.filter’s spec text, 7.c.ii and 7.c.iii

13 of 14

It just makes sense.

14 of 14

As an alternative...

  • If can’t agree on adding an Array.p.select alias, we could drop it
  • Just add Array.p.reject
    • We could even name it Array.p.filterOut