top | item 39289182

(no title)

marcandre | 2 years 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)

discuss

order

denvaar|2 years ago

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