-
-
Notifications
You must be signed in to change notification settings - Fork 401
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
[#725] New practice exercise pov
#752
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 🤖. |
@@ -0,0 +1,133 @@ | |||
defmodule Pov do |
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.
Since this exercise is basically Zipper
+ more functions, should see if we are being congruent with our approaches between the two exercises
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.
Coincidentally, I just reached the Zipper
exercise in my Elixir track. I'll go solve it real quick before looking into the repo ;)
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.
OK, I've solved it now. The approach in Zipper
is quite different from other exercises that I've seen so far since it provides a complete module for binary trees. It's not bad, should I model this one after Zipper
?
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.
I think we can start with your current implementation like it is now, and then later, if people complain that the exercise is too difficult, we could add hints in the form of a module with a data structure that we suggest using.
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.
Agreed, challenging exercises are not as much of an issue for practice exercises
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.
Thanks for the contribution! 💙 🎉
@angelikatyborska DM'd me saying she will do a proper review of your new exercise soon, I left a couple comments just to address a few points that stuck out to me.
Great work so far!
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 is 🔥 amazing 🔥. Great work!
The test.tomls from a couple of other exercises I looked into looked self generated, but I don't know how the works, so I left the file blank for now.
In theory there should a tool for generating those files from problem specifications, but I don't know at the moment if it already exists 😅. You can copy the file from https://github.com/exercism/fsharp/blob/main/exercises/practice/pov/.meta/tests.toml -> this is exactly what we need. Those files list all tests from problem specifications by id and description and define if our track implements the specific test cases or not. You would mark a test as not being implemented (on purpose) with include = false
.
I requested a tiny change to the test data (to use 0-indexing for siblings and cousins, and to write the whole word "sibling" instead of just "sub"). Otherwise it's perfect :)
"recursion", | ||
"pattern-matching" | ||
], | ||
"difficulty": 9 |
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 is exciting 🤩 looks like this will be our most difficult exercise.
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.
I have not done many of the difficulty 8, but it definitely is one step above Zipper, which is 8.
Forth is a 10 though!
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.
I think difficult 9 is okay, we don't have a firm definition what each number means anymore, so it's just to give a general feel of the complexity
@typedoc """ | ||
A tree, which is made of a node with several branches | ||
""" | ||
@type tree :: {any, [tree]} |
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.
Great simple choice 👍
|
||
defmodule Zipper do | ||
defstruct [:focus, genealogy: []] | ||
@type t :: %Zipper{focus: Pov.tree(), genealogy: [Crumb.t()]} |
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.
Dialyzer is complaining that it doesn't know the type Crumb.t
. I think that can be fixed by first defining the Crumb module, and only then the Zipper module 🤔
sorted_a = Enum.sort(children_a) | ||
sorted_b = Enum.sort(children_b) | ||
|
||
Enum.zip_with(sorted_a, sorted_b, &equal_trees/2) |
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 CI is already reporting that tests don't pass in Elixir 1.8 😢. It's because this function was introduced in Elixir 1.12. To allow as many students as possible to solve the exercises, we have a CI check that runs the example solutions against different versions of Elixir, starting at 1.7. I think it won't be a problem to rewrite this with zip
and map
instead, right?
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.
No problem indeed.
Co-authored-by: Angelika Tyborska <angelikatyborska@fastmail.com>
Co-authored-by: Angelika Tyborska <angelikatyborska@fastmail.com>
Co-authored-by: Angelika Tyborska <angelikatyborska@fastmail.com>
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.
Nice work @jiegillet!! Really well done!
I'll let @angelikatyborska merge it when she is ready, but I have no hesitation reading through this.
P.S. for @angelikatyborska, will have to be squashed to merge because of some branch issue with the commits
Thank you very much for the welcome and the fast reviews! |
Dear maintainers,
Here is an extra practice exercise described in #725.
This is my first contribution, please help me get it right, I probably missed some things.
A couple of notes:
uuid
for the exercise to add inconfig.json
. How do I get it?test.toml
s from a couple of other exercises I looked into looked self generated, but I don't know how the works, so I left the file blank for now.@type tree :: {any, [tree]}
. Is it better to make it fancier, like aMap
or aStruct
?Thank you!
Jeremie