```
defmodule Itertools
    def combinations(_, 0), do: [[]] 
    def combinations([], _), do: [] 
    def combinations([h|t], m) do 
        (for l <- combinations(t, m-1), do: [h|l]) ++ combinations(t, m) 
    end 
end 

```

I am working with a nested loop over an array that can be handled by something like Python's itertools.combinations, but don't see one in the standard library. Does elixir have it built-in somewhere, or is there a better way to simulate a triangular loop over a list in Elixir?

I got the above code from rosettacode.org btw.