Question : elixir enum chunk_every
Answered by : juan-d-khusuma
Enum.chunk_every([1, 2, 3, 4, 5, 6], 2)
[[1, 2], [3, 4], [5, 6]]
Source : https://elixirschool.com/en/lessons/basics/enum | Last Update : Fri, 20 May 22
Question : elixir enum chunk_by
Answered by : juan-d-khusuma
Enum.chunk_by(["one", "two", "three", "four", "five"], fn(x) -> String.length(x) end)
[["one", "two"], ["three"], ["four", "five"]]
Enum.chunk_by(["one", "two", "three", "four", "five", "six"], fn(x) -> String.length(x) end)
[["one", "two"], ["three"], ["four", "five"], ["six"]]
Source : https://elixirschool.com/en/lessons/basics/enum | Last Update : Fri, 20 May 22