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

04_atoms.ex has unclear expectations #226

Open
DaneWeber opened this issue Oct 3, 2018 · 7 comments
Open

04_atoms.ex has unclear expectations #226

DaneWeber opened this issue Oct 3, 2018 · 7 comments

Comments

@DaneWeber
Copy link

I'm new to Elixir and using these koans. First of all: thanks! I really appreciate them.

For the 04_atoms koans, I wasn't clear what was expected. For example, assert true == ___ and assert false == ___ can be most easily completed by simply repeating true and false.

I was guessing that perhaps it should be completed with assert true == :true.

Another thought is that these could be triple-equal, such as assert :true === ___?

Bottom line: while this definitely succeeding in driving me to think more about atoms, I would have appreciated more of a nudge.

If someone more experienced with Elixir can explain the intent, I would be happy to submit a PR to improve this koan.

@iamvery
Copy link
Collaborator

iamvery commented Nov 2, 2018

@DaneWeber thank you for the feedback! Sorry it has taken so long to get a response. Sometimes it's really hard to build an example that provides enough hint to keep folks on the straight and narrow w/o giving everything away. If you have any ideas for how to help these examples explain themselves better, we'd love to see them! Maybe even as easy as a little more in the description? Or a comment?

@DaneWeber
Copy link
Author

Thanks for the response! 😄 I'm on a pretty slow cycle too.

So, I'm an elixir newbie, but my suggestion was the following:
assert :true === ___

I would think that would point to a solution of assert :true === true. I'm assuming that is the intent of this exercise, but I wanted to make sure I'm not missing a deeper solution.

@iamvery
Copy link
Collaborator

iamvery commented Nov 21, 2018

Ah, I think I missed the subtlety of your suggestion. I like it! I agree that it would seem a bit easier to intuit what the lesson is trying to show you by going from atom to boolean rather than the opposite. Fwiw, I don't think the threequals is really necessary. I believe the only difference is numeric equality.

The only difference between == and === is that === is stricter when it comes to comparing integers and floats

What do you think @felipesere @ukutaht ?

@ukutaht
Copy link
Collaborator

ukutaht commented Nov 21, 2018

Thank you for the suggestions @DaneWeber!

I agree with @iamvery here. Showing the atom is a good improvement to the exercise but I would keep the double-equals. In my experience the convention is to always use double-equals as the default and frankly seeing a triple-equals in an elixir codebase would be pretty confusing to me.

@DaneWeber
Copy link
Author

Interesting! I came directly from 03_numbers.ex which uses === several times, and I clearly missed that it's only stricter when it comes to integers & floats. I was carrying baggage from other languages.

@iamvery
Copy link
Collaborator

iamvery commented Nov 26, 2018

I wonder if we could do more to emphasize "looky === matters for numbers"

@tkilgour
Copy link

tkilgour commented Mar 7, 2019

Found this issue because I also had no idea what assert true == ___ and assert false == ___ were expecting.

My suggestion would be to follow the same pattern from the first two koans in Numbers:

assert true == :true == ___ // expects `true`
assert false == :false == ___ // expects `true`

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

No branches or pull requests

4 participants