List.Extra.cartesianProduct with quite large datasets, that sometimes output 500K results, causing quite the CPU holdup. Only around 100 of the results are useful for my usecase.
Could somebody help me limit the number of results
List.Extra.cartesianProduct iterates for?
I tried this:
cartesianProductWithIterationLimit : Int -> List (List a) -> List (List a) cartesianProductWithIterationLimit limit pendingItems = let doIt collection slotsCount = case collection of  -> [  ] xs :: xss -> if slotsCount > 0 then lift2 (::) xs (doIt xss (slotsCount - 1)) else collection in doIt pendingItems limit
But it’s not good enough, it only limits the iterations count for the outmost “loop”.