I have a list {x1,...,xN]{x1,...,xN}
where NN
is even, and I need to find all the possible ways to split it into pairs of elements, e.g. the output I would like is something like (say N=4N = 4
):
{{{x1,x2},{x3,x4}},{{x1,x3}{x2,x4}},...}
{{{x1,x2},{x3,x4}},{{x1,x3}{x2,x4}},...}
How can this be achieved?