README.md (1257B) - raw
1 # Strain 2 3 Welcome to Strain on Exercism's Perl 5 Track. 4 If you need help running the tests or submitting your code, check out `HELP.md`. 5 6 ## Instructions 7 8 Implement the `keep` and `discard` operation on collections. Given a collection 9 and a predicate on the collection's elements, `keep` returns a new collection 10 containing those elements where the predicate is true, while `discard` returns 11 a new collection containing those elements where the predicate is false. 12 13 For example, given the collection of numbers: 14 15 - 1, 2, 3, 4, 5 16 17 And the predicate: 18 19 - is the number even? 20 21 Then your keep operation should produce: 22 23 - 2, 4 24 25 While your discard operation should produce: 26 27 - 1, 3, 5 28 29 Note that the union of keep and discard is all the elements. 30 31 The functions may be called `keep` and `discard`, or they may need different 32 names in order to not clash with existing functions or concepts in your 33 language. 34 35 ## Restrictions 36 37 Keep your hands off that filter/reject/whatchamacallit functionality 38 provided by your standard library! Solve this one yourself using other 39 basic tools instead. 40 41 ## Source 42 43 ### Created by 44 45 - @bistik 46 47 ### Contributed to by 48 49 - @kytrinyx 50 - @m-dango 51 - @rfilipo 52 53 ### Based on 54 55 Conversation with James Edward Gray II - https://twitter.com/jeg2