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

Should the koans prefer in/2 over member?/2? #269

Open
cmcaine opened this issue Oct 24, 2021 · 1 comment
Open

Should the koans prefer in/2 over member?/2? #269

cmcaine opened this issue Oct 24, 2021 · 1 comment

Comments

@cmcaine
Copy link

cmcaine commented Oct 24, 2021

These koans use Enum.member? and MapSet.member?. I only know a little Elixir, but as far as I can tell these offer no benefit over in/2 (they're the same speed and give the same results).

Similarly, MapSet.equal?/2 is used instead of ==/2, but it doesn't need to be.

Would you accept a PR that changed lines like

assert MapSet.member?(@set, 1) == ___

into

assert (1 in @set) == ___

?

Thanks for writing/maintaining these koans!

@cmcaine cmcaine changed the title member? or in? Should the koans prefer in/2 over member?/2? Oct 24, 2021
@iamvery
Copy link
Collaborator

iamvery commented Oct 25, 2021

According to the docs the in/2 "operator" is simply a macro that translates to Enum.member?/2. I would say that the koans should teach this if possible, so rather than simply replacing them, we should introduce both 🙂

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

2 participants