elixir-koans icon indicating copy to clipboard operation
elixir-koans copied to clipboard

Should the koans prefer `in/2` over `member?/2`?

Open cmcaine opened this issue 3 years ago • 1 comments

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 avatar Oct 24 '21 20:10 cmcaine

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 🙂

iamvery avatar Oct 25 '21 14:10 iamvery