I need to generate combinations for a list of 30,000 elements using the method of skyce combinations in a stream / list
1 to 30000.toStream.combinations(2).size
This function never ends. When I try to perform the same operation in python
r = list(range(1,30000))
z = itertools.combinations(r, 2)
%time sum(1 for _ in z)
The operation ends in 26.2 seconds.
What's going on here? How can I generate combinations of a very large list in scala?
source
share