Hey everyone,

I’ve been trying to generate every possible non-equal combination of N elements from a list of known size. This would be a really long list, and I would like to create these combinations and in a stream-fashion, apply filters and calculations of top.

## Example for N=3

```
list = [1, 2, 3, 4, 5, 6]
Stream.magic_method(list)
|> Stream.map(&IO.inspect/1) # [1, 2, 3], [1, 2, 4], ..., [1, 3, 5], ..., [4, 5, 6]
|> Stream.reject(fn n -> Enum.at(n, 0) == 1 end) # Rejects combinations starting with 1
|> Stream.map(&IO.inspect/1) # [2, 3, 5], ..., [4, 5, 6]
```

I’ve tried to use `Stream.transform`

and `Stream.chunk_every`

, but no luck so far.

I also thought of a way using messages between Agents as a queue to process every nested `for`

combination, but I imagine that it would be overkill.

Is there a simple way of doing it using Streams?