You can use [`Tuples`](https://reference.wolfram.com/language/ref/Tuples.html): Tuples[f[{a, b, c}, {a, b, c}]] >{f[a, a], f[a, b], f[a, c], f[b, a], f[b, b], f[b, c], f[c, a], f[c, b], f[c, c]} f @@@ Tuples[{a, b, c}, 2] > same result Tuples[f[{a, b}, {r, s, t}, {x, y}]] >{f[a, r, x], f[a, r, y], f[a, s, x], f[a, s, y], f[a, t, x], f[a, t, y], f[b, r, x], f[b, r, y], f[b, s, x], f[b, s, y], f[b, t, x], f[b, t, y]} f @@@ Tuples[{{a, b}, {r, s, t}, {x, y}}] > same result p = {a, b}; p1 = {a, a, b, b}; Tuples[f[p, p1]] > {f[a, a], f[a, a], f[a, b], f[a, b], f[b, a], f[b, a], f[b, b], f[b, b]}