5 ms·
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:
by marcandre 3y 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)
- denvaar 3y agoThat'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 <-