ListToCsv.Option.chunks

You're seeing just the function chunks, go back to ListToCsv.Option module for more information.

Specs

chunks(list(), function()) :: {list(), list(), list()}

Split list 3 part with respect orders

  • 1st not matched with fun
  • 2nd matched with fun
  • 3rd not matched with fun

Examples

iex> chunks([1, 2, 3, 3, 2, 1, 3, 2], &(&1 == 3))
{[1, 2], [3, 3], [2, 1, 3, 2]}

iex> chunks([3, 2, 3, 2, 1, 3, 2], &(&1 == 3))
{[], [3], [2, 3, 2, 1, 3, 2]}

iex> chunks([1, 2, 4, 5, 2], &(&1 == 3))
{[1, 2, 4, 5, 2], [], []}