Skip to content

parallel-letter-frequency, tournament, word-count: Use Entry#or_insert #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 3, 2016
Merged

parallel-letter-frequency, tournament, word-count: Use Entry#or_insert #155

merged 4 commits into from
Jul 3, 2016

Conversation

petertseng
Copy link
Member

@petertseng petertseng commented Jul 3, 2016

These shorten the functions by removing the need to match on the Entry cases.

This seems good to make the examples more idiomatic.

Note the exercises that still match on Entry cases but were not changed by this PR:

  • grade-school: I judged that pushing an element onto the vector then sorting it was sufficiently different from creating a vector with a single element. I can be convinced otherwise.
  • nucleotide-count: As we discuss in test cases for nucleotide count should include handing of invalid sequences #149, invalid nucleotides should maybe produce errors, so the decision resulting from that discussion may mean using or_insert doesn't make sense.

This drastically shortens the function, avoiding the need to `match` on
the `Entry` cases.
This seems good to make the example more idiomatic.
This drastically shortens the `count` function and result collection
loop in `frequency`, avoiding the need to `match` on the `Entry` cases.
This seems good to make the example more idiomatic.
This drastically shortens the function, avoiding the need to `match` on
the `Entry` cases.
This seems good to make the example more idiomatic.
@petertseng
Copy link
Member Author

travis didn't pick this up for testing. kicking it.

@petertseng petertseng closed this Jul 3, 2016
@petertseng petertseng reopened this Jul 3, 2016
This drastically shortens the function, avoiding the need to `match` on
the `Entry` cases.
This seems good to make the example more idiomatic.
@petertseng
Copy link
Member Author

I also decided to make the change for grade-school.

@IanWhitney
Copy link
Contributor

These are definitely more like the solutions I see being submitted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants