how would you call what I called `cartesianProduct...
# random
t
how would you call what I called
cartesianProduct
?
Copy code
listOf(1, 2, 3, 4).cartesianProduct() shouldContainExactlyInAnyOrder listOf(
  listOf(1),
  listOf(2),
  listOf(3),
  listOf(4),
  listOf(1, 2),
  listOf(1, 3),
  listOf(1, 4),
  listOf(2, 3),
  listOf(2, 4),
  listOf(3, 4),
  listOf(1, 2, 3),
  listOf(1, 2, 4),
  listOf(1, 3, 4),
  listOf(2, 3, 4),
  listOf(1, 2, 3, 4)
)
permutations? combinations? I know it is something, but cannot figure out what
m
Maybe
powerSet()
? The power set should include the empty set as well though.
2
t
for my use case, the empty set is not needed. but I can still call the method something on the line of powerSet (nonEmptyPowerSet, or just remove the empty set in a second step)
m
Yes, it’s a powerset P(A), minus the empty set. A cartesian product between two sets A and B is the set of all ordered pairs (ab)
👍 1