I have two large lists:
list1 = {{a,v},{a,h},{b,v},{b,k},{c,t},{c,r},{d,r}};list2 = {{v,dc},{v,rt},{h,kl},{h,oi},{h,po},{k,ö},{k,dc},{t,re},{r,qw},{r,ay},{r,ül}};
Now I want a list that matches both lists so that the first element of each row in list1
is matched with the second element of each row in list 2
based on the same values of second element of each row in list1
and the first element of each row in list2
. For example list3
should yield
{{a,dc},{a,rt},{a,kl},{a,oi},{a,po},...}
I have developed a very clumsy (and very very slow) solution with nested tables so I am sure there is a faster one? I have also tried something with Associations
but this will either lead to a kernel crash or loss of data (as duplicate keys will be removed).Thank you