Closed mgold closed 6 years ago
I'm pretty sure that cartesianProduct2
is just List.Extra.lift2 (,)
. Please correct me if I'm wrong. I think that having such a function might be encouraging an anti-pattern since typically you want to do something with the pairs for which lift2
is more suitable.
Yes, that's correct. Thank you for pointing that out.
This is a variation of
cartesianProduct
for when exactly two lists are being used. Instead of a list of lists -- the inner lists having length 2 -- the inner lists are replaced by pairs.This came up in a project I was working on. Just as a sketch of utility, expanding a tree according to all possible transformations of an element: