Last active
April 26, 2016 11:21
-
-
Save tonini/4f0400808ad19bcd6c7e7a75b783a39e to your computer and use it in GitHub Desktop.
for.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for {k, v} <- keyword, | |
| v = process_value(v), | |
| into: %{} do | |
| {v, k} | |
| end |
Perhaps this:
for {k, v} <- keyword,
v = process_value(v),
into: %{} do
{v, k}
endLooks a bit odd to me though.
Not sure if you need another option but I thought it's also possible to do this:
for {k, v} <- keyword,
v = process_value(v),
into: %{}
do
{v, k}
end
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is another option. The parts of the list comprehension is aligned, and the do block is indented one level:
I am sure this would look better if there was more in the do-block.