Do I understand you correctly, that you want to have a list of tails?
So for [1,2,3] you want to have [[1,2,3],[2,3],[3],[]]?
def tails(list) when is_list(list), do: tails(list, [list])
defp tails([], acc), do: Enum.reverse(acc)
defp tails([_|t], acc), do: tails(t, [t | acc])
If I did not understand you correctly, can you please get a bit more into detail and show some sample input and expected output?






















