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

added the book store exercise #365

Merged
merged 7 commits into from
Oct 16, 2023
Merged

Conversation

massivefermion
Copy link
Contributor

No description provided.

@lpil lpil added the x:rep/large Large amount of reputation label Oct 11, 2023
Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

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

Wonderful! Thank you very much. I've left 2 small notes inline.

}

fn calculate(counts: List(Int), acc: Float) -> Float {
case counts {
Copy link
Member

Choose a reason for hiding this comment

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

This case expression is not exhaustive and won't compile with future versions of Gleam. What happens when there are fewer than 5 elements?

If the number of elements is fixed then this should likely be a tuple and not a list, or a function that takes 5 int arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The list would always have five elements because of the initial state of the fold. But I changed it so that the clauses are exhaustive.

Copy link
Member

Choose a reason for hiding this comment

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

If you wish to assert that the pattern matches you'll need to use let assert. An inexhaustive let will be rejected by the compiler in future.

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 to know. done!

config.json Outdated
@@ -1826,14 +1781,21 @@
"slug": "nth-prime",
"name": "Nth Prime",
"uuid": "fda0001e-51b5-4041-a08a-2cb7dfef0f1c",
"practices": [
],
"practices": [],
Copy link
Member

Choose a reason for hiding this comment

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

Could you undo the unrelated changes in this file please? Thank you

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry about this! I always forget about my format on save!

config.json Outdated
"uuid": "f45f7c07-465a-4fec-b7ed-263d770d580c",
"practices": [
],
"prerequisites": [],
Copy link
Member

Choose a reason for hiding this comment

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

Could you add some practices and prerequisites? Thank you.

Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

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

Thank you

@lpil lpil merged commit 0275b16 into exercism:main Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:rep/large Large amount of reputation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants