-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Conversation
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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": [], |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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": [], |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
No description provided.