-
-
Notifications
You must be signed in to change notification settings - Fork 398
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
[#726] New practice exercise satellite
#756
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 🤖. |
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.
Looks good by me!
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.
❤️ 🧡 💛 💚 💙 💜
@doc """ | ||
Build a tree from the elements given in a pre-order and in-order style | ||
""" | ||
@spec build_tree(preorder :: [any], inorder :: [any]) :: tree | {:error, String.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.
I forgot to pay attention to this in the previous PRs: the more "Elixir way" would be to return:
{:ok, tree} | {:error, String.t()}
Usually functions that return an error tuple when something goes wrong, return an ok-tuple when everything is fine (a few examples: File.read, DateTime.new, Ecto.Repo.insert). It would be nice if our exercises followed that convention too.
It would be great if you did that change in POV too. Better in a separate PR, that will give you extra reputation points 😬 (reputation is a new feature in v3, it's just some points that you can collect but not really use for anything).
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. Actually at some point I had an implementation that used {:ok, tree}
and all the checks along the way used with
instead of using MapSet
but I found it a bit bulky. It was the better design in the end.
I'll revisit POV too, what wouldn't I do for useless internet points :)
Co-authored-by: Angelika Tyborska <[email protected]>
And another one getting merged 🚀 🎉 |
One more. I really enjoyed coming up with a clean algorithm for this one!
The metadata file was missing a source and URL.