Skip to content
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

hamming: Updated the exercise to the 2.1.1 version #762

Merged
merged 3 commits into from
Nov 24, 2018

Conversation

ZapAnton
Copy link
Contributor

@@ -1,14 +1,21 @@
extern crate hamming;

fn process_distance_case(strand_pair: [&str; 2], expected_distance: Option<usize>) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious why you wrote this as [&str; 2] instead of (&str, &str). I tend to think of function arguments as tuple-like instead of array-like, so the latter would have seemed more natural to me.

I suspect that the two forms are equivalent in memory, and this does work; you certainly don't need to change it. I'm just curious about your design process.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Guess I decided to go with the array, because the types of the variables are similar (perhaps a little C-like design).

If the strands where represented with different types, e.g. LeftStrand / RightStrand, then I would surely used the tuple.

@petertseng petertseng added sync/tests Keep a test suite/version in sync with exercism/problem-specifications sync/readme Keep a README in sync with exercism/problem-specifications labels Nov 20, 2018
@petertseng
Copy link
Member

Since this also updates the README, exercism/problem-specifications#1360 is now also relevant.

Copy link
Member

@petertseng petertseng left a comment

Choose a reason for hiding this comment

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

Although the ordering isn't the same as what's in canonical-data.json (and I also couldn't find much of a rhyme or reason to this new order), for this exercise I find that I do not really care about the order

@coriolinus coriolinus merged commit 8bc3d7d into exercism:master Nov 24, 2018
@ZapAnton ZapAnton deleted the update_hamming branch November 25, 2018 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sync/readme Keep a README in sync with exercism/problem-specifications sync/tests Keep a test suite/version in sync with exercism/problem-specifications
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants