May 2018
Intermediate to advanced
412 pages
9h 3m
English
Our next transformation is to extract the first count entries from the list. Resisting the temptation to write the function ourselves (How would you write such a function?), we discover the built-in Enum.take:
| | def process({user, project, count}) do |
| | Issues.GithubIssues.fetch(user, project) |
| | |> decode_response() |
| | |> sort_into_descending_order() |
| » | |> last(count) |
| | end |
| | |
| | def last(list, count) do |
| | list |
| | |> Enum.take(count) |
| | |> Enum.reverse |
| | end |
Read now
Unlock full access