Given two lists and a third list which has values that map to the permutations of the first two, I would like to create a Map of list1's key, list2's key, and list3's value. How can I get list3's value at a certain index if I am inside the loop?
Using Enum.at
is not the correct solution for this, I understand - it will traverse the whole list on every iteration. And if I try [head | tail] = list3
, it looks like I can't just set list3 = tail
for the next loop.
list1 = [1,2]
list2 = [3,4]
list3 = 'wxyz'
Enum.each(list1), fn i ->
Enum.each(list2), fn j ->
# Would like to just chop off the first value of list3 and
# pass the tail into the next iteration
end
end