Skip to content

Add practice exercise piecing-it-together #1576

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jiegillet
Copy link
Contributor

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.

Copy link
Contributor

github-actions bot commented Jun 7, 2025

Thank you for contributing to exercism/elixir 💜 🎉. This is an automated PR comment 🤖 for the maintainers of this repository that helps with the PR review process. You can safely ignore it and wait for a maintainer to review your changes.

Based on the files changed in this PR, it would be good to pay attention to the following details when reviewing the PR:

  • General steps

    • 🏆 Does this PR need to receive a label with a reputation modifier (x:size/{tiny,small,medium,large,massive})? (A medium reputation amount is awarded by default, see docs)
  • Any exercise changed

    • 👤 Does the author of the PR need to be added as an author or contributor in <exercise>/.meta/config.json (see docs)?
    • 🔬 Do the analyzer and the analyzer comments exist for this exercise? Do they need to be changed?
    • 📜 Does the design file (<exercise>/.meta/design.md) need to be updated to document new implementation decisions?
  • Practice exercise changed

    • 🌲 Do prerequisites, practices, and difficulty in config.json need to be updated?
    • 🧑‍🏫 Are the changes in accordance with the community-wide problem specifiations?
  • Practice exercise tests changed

    • ⚪️ Are all tests except the first one skipped?
    • 📜 Does <exercise>/.meta/tests.toml need updating?

Automated comment created by PR Commenter 🤖.

Copy link
Member

@angelikatyborska angelikatyborska left a comment

Choose a reason for hiding this comment

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

Woohoo, more exercises 🙂

Fill in missing jigsaw puzzle details from partial data
"""

defmodule JigsawPuzzle do
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: I'm not sure if I would have chosen a nested module for this exercise. I think I would have created a module called JigsawPuzzle (not nested) with a function data, and that's it 🤔

Comment on lines +9 to +15
pieces: pos_integer(),
rows: pos_integer(),
columns: pos_integer(),
format: format(),
aspect_ratio: float(),
border: pos_integer(),
inside: pos_integer()
Copy link
Member

Choose a reason for hiding this comment

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

Should this type be extended somehow to signal that any of those values might be nil when used as an input? If this was typescript, I would define the function as (input: Parial<JigsawPuzzle>): JigsawPuzzle 👻

Comment on lines +2682 to +2684
"practices": [
"structs"
],
Copy link
Member

Choose a reason for hiding this comment

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

Maybe like this? There's a lot of math:

Suggested change
"practices": [
"structs"
],
"practices": [
"structs",
"integers",
"floating-point-numbers"
],

Comment on lines +2686 to +2693
"structs",
"errors",
"multiple-clause-functions",
"pattern-matching",
"guards",
"if",
"case",
"floating-point-numbers"
Copy link
Member

Choose a reason for hiding this comment

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

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)

@@ -0,0 +1,174 @@
defmodule PiecingItTogether do
@doc """
TODO: add function description and replace types in @spec
Copy link
Member

Choose a reason for hiding this comment

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

👀

@angelikatyborska
Copy link
Member

but I mostly stuck to the test cases.

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 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants