Add practice exercise piecing-it-together#1576
Conversation
|
Thank you for contributing to Based on the files changed in this PR, it would be good to pay attention to the following details when reviewing the PR:
Automated comment created by PR Commenter 🤖. |
angelikatyborska
left a comment
There was a problem hiding this comment.
Woohoo, more exercises 🙂
| "structs", | ||
| "errors", | ||
| "multiple-clause-functions", | ||
| "pattern-matching", | ||
| "guards", | ||
| "if", | ||
| "case", | ||
| "floating-point-numbers" |
There was a problem hiding this comment.
You have also used: enum, keyword-lists, maps, erlang-libraries. Which ones are really necessary for this exercise?
I'm assuming erlang-libraries are optional because Integer/Float.pow can be used instead of :math.sqrt. Is it common knowledge that pow(x, 0.5) == sqrt(x)?
As for enum, maps, and keyword-lists, they all come from the fact that you've turned then input struct into a keyword list. Was that really necessary? Can the exercise be solved without that?
|> Map.from_struct()
|> Enum.filter(fn {_, value} -> value end)
|> Enum.sort_by(fn {key, _} -> key end)There was a problem hiding this comment.
I'm sure people know that pow(x, 0.5) == sqrt(x, but :math.sqrt is so much more natural, I didn't think twice before using it.
I'll add all of your suggestions, it's not really about whether they are all necessary (I'm sure you could write solutions that don't use them all), it's more about whether knowing about all these concepts can help you write a nice solution, and I think this is the case.
Did you "mostly" stuck to the test cases, or "fully" stuck to the test cases? I was trying to find anything in the tests that doesn't come from problem specs but couldn't 🤔 |
Co-authored-by: Angelika Cathor <angelikatyborska@fastmail.com>
The tests are strictly identical to the problem specs. What I meant is that there is one test that expects |
Fun little exercise! Great use of the quadratic formula 💯
The idea is to fill in partial information about a jigsaw puzzle.
There are tons of ways information might be missing or contradictory, but I mostly stuck to the test cases.