Unit Testing, Property Testing, Elixir Language, Elixirlang, Refactoring.
Enum.count() |> Integer.mod(k) |> ceil_div.(chunk_size) > 0 do list |> into_buckets(k, chunk_size) |> distribute_extra() else 0 -> list = Enum.chunk_every(list, 1, 1, []) empty_buckets = k - Enum.count(list) Enum.reduce(1..empty_buckets, list, fn _, acc -> acc ++ [[]] end) false -> chunk_size =