-
-
Save tfwright/bfab5e3105c027e4a52f52ae06031e2a to your computer and use it in GitHub Desktop.
This file contains 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
System.argv() | |
|> List.first() | |
|> File.stream!() | |
|> Enum.reduce(0, fn | |
"A X" <> _, total -> total + 3 + 1 | |
"B X" <> _, total -> total + 0 + 1 | |
"C X" <> _, total -> total + 6 + 1 | |
"A Y" <> _, total -> total + 6 + 2 | |
"B Y" <> _, total -> total + 3 + 2 | |
"C Y" <> _, total -> total + 0 + 2 | |
"A Z" <> _, total -> total + 0 + 3 | |
"B Z" <> _, total -> total + 6 + 3 | |
"C Z" <> _, total -> total + 3 + 3 | |
end) | |
|> IO.inspect |
This file contains 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
System.argv() | |
|> List.first() | |
|> File.stream!() | |
|> Enum.reduce(0, fn | |
"A X" <> _, total -> total + 0 + 3 | |
"B X" <> _, total -> total + 0 + 1 | |
"C X" <> _, total -> total + 0 + 2 | |
"A Y" <> _, total -> total + 3 + 1 | |
"B Y" <> _, total -> total + 3 + 2 | |
"C Y" <> _, total -> total + 3 + 3 | |
"A Z" <> _, total -> total + 6 + 2 | |
"B Z" <> _, total -> total + 6 + 3 | |
"C Z" <> _, total -> total + 6 + 1 | |
end) | |
|> IO.inspect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment