problem-specifications/exercises/strain/description.md at 578f37a3bde48be53726747c9ce3158102bb2880 · exercism/problem-specifications · GitHub references functions twice in that line, but before that point, keep
and discard
are repeatedly referenced to as operations. I’d like to change the references to functions to instead be operations for consistency.
I’d also like to propose moving this part to near the top.
“Implement the keep
and discard
operation on collections.
Given a collection and a predicate on the collection’s elements, keep
returns a new collection containing those elements where the predicate is true, while discard
returns a new collection containing those elements where the predicate is false.
The operations may be called keep
and discard
, or they may need different names in order to not clash with existing operations or concepts in your language.”
The content that follows is a dive into how keep
and discard
both work so it’s not obvious without reading the whole instructions that the names might be different. I’m certainly guilty of not reading the strain directions before.