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

parallel-letter-frequency: Implement exercise to resolve #744 #891

Merged
merged 4 commits into from
Nov 7, 2017
Merged

parallel-letter-frequency: Implement exercise to resolve #744 #891

merged 4 commits into from
Nov 7, 2017

Conversation

forgeRW
Copy link
Contributor

@forgeRW forgeRW commented Oct 14, 2017

Resolves #744. Ready for another review. Thanks.

Copy link
Contributor

@ilya-khadykin ilya-khadykin left a comment

Choose a reason for hiding this comment

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

Looks solid, good job!

I left some minor comments, please take a look

import unittest

from parallel_letter_frequency import calculate

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please also leave a comment stating what version of canonical-data.json the tests were adopted as discussed in #784 if aplicable?
The format is:

# Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was unable to find a canonical-data.json in https://github.com/exercism/problem-specifications/tree/master/exercises/parallel-letter-frequency. I noticed that there is an open task for creating one (exercism/problem-specifications#574). Should I still add the comment?

Copy link
Contributor

Choose a reason for hiding this comment

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

@forgeRW probably. You can point out that there was no canonical-data.json at the time



def count_letters(queue_of_texts, letter_to_frequency, worker_id):
while True:
Copy link
Contributor

Choose a reason for hiding this comment

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

Generally it's a bad practice to you use infinite loops, but I think you know it
Maybe something like this:

while not queue_of_texts.task_done():
    # do stuff

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the feedback. I removed this in my latest commit.

worker.start()
threads.append(worker)
queue_of_texts.join()
for i in range(total_workers):
Copy link
Contributor

@ilya-khadykin ilya-khadykin Oct 16, 2017

Choose a reason for hiding this comment

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

Just an alternative:

[queue_of_texts.put(None) for _ in range(total_workers)]

There is a convention to use _ if the variable isn't really required

For threads

[t.join() for t in threads]

Copy link
Contributor

@cmccandless cmccandless left a comment

Choose a reason for hiding this comment

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

@forgeRW Just one minor formatting change, then you should be good!

The letters used consists of ASCII letters `a` to `z`, inclusive, and is case
insensitive.

### Submitting Exercises
Copy link
Contributor

Choose a reason for hiding this comment

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

Re #950, this should be ## Submitting Exercises

@ilya-khadykin
Copy link
Contributor

@cmccandless let's merge it as is and make minor corrections you mentioned ourselves? How does it sound?

@cmccandless cmccandless merged commit ca6b9fc into exercism:master Nov 7, 2017
@cmccandless
Copy link
Contributor

@m-a-ge I agree. Done.

@forgeRW Merged! Congrats, and thanks for working on this!

@AtelesPaniscus
Copy link
Contributor

Hello,

This appears to be a level 5 exercise inserted between two level 1 exercises in config.json. Probably something to do with alphabetical ordering.

Is this what is wanted ?

I'm still working my way through level 1 exercises. Can I skip this beast and come back to it in 10 years time or should I just abandon this track ?

@ilya-khadykin ilya-khadykin mentioned this pull request Nov 10, 2017
4 tasks
@ilya-khadykin
Copy link
Contributor

@AtelesPaniscus thanks a lot for your input! Of course you can do that.
That is an issue we have to deal with ASAP. We still have to decide on core exercises and an actual order. We appreciate if you can give us your point of view on this in #1099

smalley pushed a commit to smalley/python that referenced this pull request Nov 12, 2017
…exercism#891)

* parallel-letter-frequency: Implement exercise to resolve exercism#744

* parallel-letter-frequency: Removed infinite loop

* parallel-letter-frequency: README format fixes
smalley pushed a commit to smalley/python that referenced this pull request Nov 12, 2017
…exercism#891)

* parallel-letter-frequency: Implement exercise to resolve exercism#744

* parallel-letter-frequency: Removed infinite loop

* parallel-letter-frequency: README format fixes
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.

4 participants