Skip to content

Add implementation of custom-set exercise #19

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 2 commits into from
Oct 15, 2014

Conversation

pminten
Copy link
Contributor

@pminten pminten commented Oct 12, 2014

This may be slightly different from other tracks' custom set exercises as I've
adapted the exercise to fit in with how the current sets in the rust base lib
work.

The example.rs has become quite large (260 lines) even though the conceptual complexity is fairly low (most of the tricky stuff is in DiffIter and insert, the rest is fairly straightforward).

Would appreciate a code review on this one, maybe I'm making some stuff more complicated than it needs to be.

This may be slightly different from other tracks' custom set exercises as I've
adapted the exercise to fit in with how the current sets in the rust base lib
work.
pminten added a commit that referenced this pull request Oct 12, 2014
(Adding at the top for purely git technical reasons, #19 also modifies this file
and I hope to avoid a (fairly trivial) merge conflict.)
}

fn difference(a: Vec<uint>, b: Vec<uint>) -> Vec<uint> {
make_set(a).difference(&make_set(b)).map(|n| n.clone()).collect()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires that the iterator for set return the result in-order.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks.

@pminten
Copy link
Contributor Author

pminten commented Oct 13, 2014

Fixed issues pointed to by @etrepum. Thanks for the review.

pminten added a commit that referenced this pull request Oct 15, 2014
Add implementation of custom-set exercise
@pminten pminten merged commit 7581399 into exercism:master Oct 15, 2014
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