Skip to content
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

[#793] New practice exercise word-search #804

Merged
merged 4 commits into from
Jul 3, 2021

Conversation

jiegillet
Copy link
Contributor

As promised :)

@github-actions
Copy link
Contributor

github-actions bot commented Jul 1, 2021

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 🤖.

@jiegillet
Copy link
Contributor Author

1.7 is failing. Any guess? Enum.with_index? My Elixir journey started with 1.9 I think :)

@angelikatyborska
Copy link
Member

I have all the minor Elixir versions installed with asdf just for this case. I'll check :D

@angelikatyborska
Copy link
Member

This is what I get with Elixir 1.7 and Erlang 23.0. I'm unable to install Erlang 22 or 21 because they're too old for my system version:

$ mix test --include pending
Compiling 1 file (.ex)

== Compilation error in file lib/word_search.ex ==
** (MatchError) no match of right hand side value: []

@angelikatyborska
Copy link
Member

I think :reduce for list comprehensions was only added in 1.8 but I can't confirm that for sure (source: elixir-lang/elixir@5ce4b61)

@neenjaw did we want to drop 1.7 if it starts go cause trouble?

@neenjaw
Copy link
Contributor

neenjaw commented Jul 1, 2021

for's :reduce option was added in 1.8. It is present in the docs in 1.8 and absent in the docs for 1.7.

Enum.with_index/1 is present in 1.7.4

If this is a good way to solve it, this may be a good case to prompt us to drop 1.7 support. I haven't reviewed the example solution.

@jiegillet
Copy link
Contributor Author

jiegillet commented Jul 2, 2021

Is there a way to add an error track for the CI more detailed than Pass/Fail? I don't know much about this.

I'm using :reduce twice. Not a bit deal to pipe the result into Enum.reduce I suppose.
I'll wait for a review before making changes though. Thank you as always :)

output = WordSearch.search(grid, words)

expected = %{
"clojure" => %Location{from: {10, 1}, to: {10, 7}}
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should make the coordinates more explicit like this:

Suggested change
"clojure" => %Location{from: {10, 1}, to: {10, 7}}
"clojure" => %Location{from: %{row: 10, column: 1}, to: %{row: 10, column: 7}}

When I first saw {10, 1}, I thought: {x, y}, which is basically the opposite of what it really is 😁

Copy link
Contributor

Choose a reason for hiding this comment

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

☝🏻 agreed, it isn't intuitive from a pair of numbers to know what they mean if not {x, y}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's quite interesting, to me {row, column} is by far the most intuitive. I guess it's because I'm from a physics/math background and that's how you manipulate matrices.
Originally the tests included explicitly row and column, I'll put them back in. Sorry about that!

@angelikatyborska angelikatyborska added the x:size/large Large amount of work label Jul 2, 2021
defmodule WordSearch do
defmodule Location do
defstruct [:from, :to]
@type t :: %Location{from: {integer, integer}, to: {integer, integer}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Secondary to that comment in the test file, we should either standardize this to {x, y} or find a way to communicate an alternative meaning to the tuple pair

Copy link
Contributor

@neenjaw neenjaw left a comment

Choose a reason for hiding this comment

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

Just curious for your thoughts how we might be able to ease the expectation of knowing the interpretation of that tuple-pair, otherwise looks great

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.

Looks perfect to me now 🥳 @neenjaw?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:size/large Large amount of work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants