I want to combine two list in the following way without using Table
or any loop structure.
genList[n_] := Table[RandomInteger[{1, 10}, 4], n] (* list generating function*)
The two lists that needs to be combined are:-
list1 = genList[3]
list2 = genList[4]
What I want to achieve is as follows:-
Partition[
Flatten[
Table[{list1[[i]], list2[[j]]}, {i, 1
Length[list1]},{j,1 Length[list2]}]
]
,8]
So I simply need to enumerate each of the elements of list 1 combined with all of the elements of list 2.
What would be an efficient way of doing this with large lists?
Let's say with Length[list1] = 100
and Length[list2] = 200
.
Also Length[list2] > Length[list1]