May 2018
Intermediate to advanced
412 pages
9h 3m
English
Now let’s continue down our data-transformation chain. Having parsed our arguments, we need to transform them by fetching data from GitHub. So we’ll extend our run function to call a process function, passing it the value returned from the parse_args function. We could have written this:
| | process(parse_args(argv)) |
But to understand this code, you have to read it right to left. I prefer to make the chain more explicit using the Elixir pipe operator:
| | def run(argv) do |
| | argv |
| | |> parse_args |
| | |> process |
| | end |
We need two variants of the process function. One handles the case where the user asked for help and parse_args returned :help. The other handles the case where a ...
Read now
Unlock full access