O'Reilly logo

Programming Elixir by Dave Thomas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Transformation: Take First n Items

Our next transformation is to extract the first count entries from the list. Rather than write a function, we’ll use the built-in Enum.take:

 
def​ process({user, project, count}) ​do
 
Issues.GithubIssues.fetch(user, project)
 
|> decode_response
 
|> convert_to_list_of_hashdicts
 
|> sort_into_ascending_order
*
|> Enum.take(count)
 
end

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required