Today I Learned

hashrocket A Hashrocket project

Stepping into Elixir Ranges

Elixir 1.12 introduced a new syntax suggar into Ranges first..last//step.

iex(1)> 1..10 |> Enum.to_list()
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

iex(2)> 1..10//2 |> Enum.to_list()
[1, 3, 5, 7, 9]

iex(3)> 1..10//3 |> Enum.to_list()
[1, 4, 7, 10]

The same could already be done with the amazing Stream module by using the take_every/2.

See More #elixir TILs
Looking for help? At Hashrocket, we 💜 Elixir! From our many Elixir client projects, to sponsoring the Chicago Elixir Meetup, to the source code for this application, we are invested in this community. Contact us today to talk about your Elixir project.