Transformation: Take First n Items

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