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

[#764] New practice exercise book-store #778

Merged
merged 5 commits into from
Jun 26, 2021

Conversation

jiegillet
Copy link
Contributor

Last one of the open issues for new exercises.

In my example solution I use Agent to memoize the possible discounts, but it is not really necessary (the tests went from taking 0.1s to 0.06s after I added it), so I didn't include it in the requirements.

Speaking of, enum and recursion are full, so I put list-comprehensions but it's a stretch. Something we could do is encourage people to use to memoization with processes in a hint/extra instructions so they can practice that.

@github-actions
Copy link
Contributor

Thank you for contributing to exercism/elixir 💜 🎉. This is an automated PR comment 🤖 for the maintainers of this repository that helps with the PR review process. You can safely ignore it and wait for a maintainer to review your changes.

Based on the files changed in this PR, it would be good to pay attention to the following details when reviewing the PR:

  • General steps

    • 🏆 Does this PR need to receive a label with a reputation modifier (reputation/contributed_code/{minor,major})? (A medium reputation amount is awarded by default, see docs)
  • Any exercise changed

    • 👤 Does the author of the PR need to be added as an author or contributor in <exercise>/.meta/config.json (see docs)?
    • 🔬 Do the analyzer and the analyzer comments exist for this exercise? Do they need to be changed?
    • 📜 Does the design file (<exercise>/.meta/design.md) need to be updated to document new implementation decisions?
  • Practice exercise changed

    • 🌲 Do prerequisites, practices, and difficulty in config.json need to be updated?
    • 🧑‍🏫 Are the changes in accordance with the community-wide problem specifiations?
  • Practice exercise tests changed

    • ⚪️ Are all tests except the first one skipped?
    • 📜 Does <exercise>/.meta/tests.toml need updating?

Automated comment created by PR Commenter 🤖.

Copy link
Contributor

@angelikatyborska angelikatyborska left a comment

Choose a reason for hiding this comment

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

the tests went from taking 0.1s to 0.06s after I added it
I see a similar difference is speed on my machine. Still, 0.1s for the test suite is very fast anyway :)

Something we could do is encourage people to use to memoization with processes in a hint/extra instructions so they can practice that.

I think this would only make sense if students struggle with making the solution as fast as yours is without Agent. I find it hard to predict right now if that will be the case. We will need to wait and see, and then ask the mentors what students do with this exercise.

If you're interested in making code run fast, we have an example solution to pythagorean-triplet that takes 10s on my machine to pass the tests. I wonder if it can be improved further? I think it was already improved from 40s.


@tag :pending
test "Four groups of four are cheaper than two groups each of five and three" do
# Suggested grouping, [[1,2,3,4],[1,2,3,5],[1,2,3,4],[1,2,3,5]].
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 leaving the comments in seems helpful

exercises/practice/book-store/lib/book_store.ex Outdated Show resolved Hide resolved
"recursion"
],
"practices": [
"list-comprehensions"
Copy link
Contributor

Choose a reason for hiding this comment

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

If nothing fits or everything that fits already has 10 exercises, we could also leave this empty.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or we can also leave lists comprehensions and see if people complain :)

@jiegillet
Copy link
Contributor Author

I think this would only make sense if students struggle with making the solution as fast as yours is without Agent. I find it hard to predict right now if that will be the case. We will need to wait and see, and then ask the mentors what students do with this exercise.

Sounds good :)

If you're interested in making code run fast, we have an example solution to pythagorean-triplet that takes 10s on my machine to pass the tests. I wonder if it can be improved further? I think it was already improved from 40s.

My solution (a slight adaptation of this one) runs in 0.06 seconds (on the updated tests of this repo, not the ones in the link). Not bad :)
The trick is not really computational though, it's mathematical: generating primitive pythagorean triples makes it really easy. I also found a typo in the test, I'll do a quick PR.

Co-authored-by: Angelika Tyborska <[email protected]>
@angelikatyborska angelikatyborska added the x:size/large Large amount of work label Jun 26, 2021
@angelikatyborska
Copy link
Contributor

angelikatyborska commented Jun 26, 2021

IMO good to merge. I'll check up with Tim if we wants to review too or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:size/large Large amount of work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants