Sha256: 8c3db7493aa27c9f4e982b76a2eab761b1b2be9c59f4351a5ce8d38223d5765b

Contents?: true

Size: 1.68 KB

Versions: 60

Compression:

Stored size: 1.68 KB

Contents

# Strain

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.

For example, given the collection of numbers:

1, 2, 3, 4, 5
And the predicate:

is the number even?
Then your keep operation should produce:

2, 4
While your discard operation should produce:

1, 3, 5
Note that the union of keep and discard is all the elements.

The functions may be called keep and discard, or they may need different names in order to not clash with existing functions or concepts in your language.

Restrictions -

The  filter/reject/whatchamacallit functionality provided by the standard library should not be used! This should be solved using other basic tools instead.

## Setup

There are two different methods of getting set up to run the tests with Objective-C:

- Create an Xcode project with a test target which will run the tests.
- Use the ruby gem `objc` as a test runner utility.

Both are described in more detail here: http://exercism.io/languages/objective-c

### Submitting Exercises

When submitting an exercise, make sure your solution file is in the same directory as the test code.

The submit command will look something like:

```shell
exercism submit <path-to-exercism-workspace>/objective-c/strain/Strain.m
```

You can find the Exercism workspace by running `exercism debug` and looking for the line beginning
with Workspace.

## Submitting Incomplete Solutions
It's possible to submit an incomplete solution so you can see how others have completed the exercise.

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
trackler-2.2.1.159 tracks/objective-c/exercises/strain/README.md
trackler-2.2.1.158 tracks/objective-c/exercises/strain/README.md
trackler-2.2.1.157 tracks/objective-c/exercises/strain/README.md
trackler-2.2.1.156 tracks/objective-c/exercises/strain/README.md
trackler-2.2.1.155 tracks/objective-c/exercises/strain/README.md
trackler-2.2.1.154 tracks/objective-c/exercises/strain/README.md
trackler-2.2.1.153 tracks/objective-c/exercises/strain/README.md
trackler-2.2.1.152 tracks/objective-c/exercises/strain/README.md
trackler-2.2.1.151 tracks/objective-c/exercises/strain/README.md
trackler-2.2.1.150 tracks/objective-c/exercises/strain/README.md
trackler-2.2.1.149 tracks/objective-c/exercises/strain/README.md
trackler-2.2.1.148 tracks/objective-c/exercises/strain/README.md
trackler-2.2.1.147 tracks/objective-c/exercises/strain/README.md
trackler-2.2.1.146 tracks/objective-c/exercises/strain/README.md
trackler-2.2.1.145 tracks/objective-c/exercises/strain/README.md
trackler-2.2.1.144 tracks/objective-c/exercises/strain/README.md
trackler-2.2.1.143 tracks/objective-c/exercises/strain/README.md
trackler-2.2.1.142 tracks/objective-c/exercises/strain/README.md
trackler-2.2.1.141 tracks/objective-c/exercises/strain/README.md
trackler-2.2.1.140 tracks/objective-c/exercises/strain/README.md