I am dealing with Tuples of n lists each having potentially different length:
longList = Tuples[list1, list2, ..., listn]:
Since I have to iterate over the elements of longList, precomputing of longList becomes a memory issue very quickly. That's why I'm looking for a lazy list implementation where I can access the ith element of longList without precomputing the whole list.
I came across this piece of code which does almost exactly what I want: Lazy lists of Tuples and Subsets
Unfortunately, it seems to only work with Tuples made from a common list, i.e. tuples taking the form:
Tuples[list,n]
I wonder wheter there is a way to either adjust the linked code or whether anyone is aware of a solution to this type of problem.
Thank you very much
take[listOfLists__,{start_,end_}]gives you just one element whenstart=end. Example:take[{a /@ Range[10^6], b /@ Range[10^6], c /@ Range[10^6]}, {23 10^5, 23 10^5}]$\mapsto${{a[1], b[3], c[300000]}}. – John Joseph M. Carrasco Aug 10 '17 at 16:50b[15]:take[{a/@Range[10^6], (b/@Range[10^6])[[{15}]], c/@Range[10^6]}, {start,end}]– John Joseph M. Carrasco Aug 10 '17 at 17:01