Hacker News new | ask | show | jobs
by marcandre 862 days ago
A nitpick of mine is how filtering with `for` is not explicit.

  arg = [1, 2, 3]
  # This doesn't crash:
  for {key, value} <- arg, do: ...
  # But this will:
  Enum.map(arg, fn {key, value} -> ... end)
1 comments

That's interesting, I never noticed that subtlety. I think the docs for `for` kind of get at that:

> Generators can also be used to filter as it removes any value that doesn't match the pattern on the left side of <-