I have lists created by other processing steps, which are basically constituted by elements like this:
{a, b, c, {d,e,f}, g, h} (*this is the typical element in the first list*)
and
{a, b, c, {d,e,f}, i, l} (*this one of the second*)
What I'd like to do to is: for each element in the first list, each time that a,b,c,{d,e,f}
are the same, join the elements and obtain a list of elements like:
{a, b, c, {d,e,f}, g, h, i, l}.
a,b,c,{d,e,f}
are guaranteed to be in the same position, but of course they vary in value and order, hence the matching.
Any ideas?
Additionally, it would be great to do this in a "fast and efficient" way, since the lists I'll deal with will be rather long.
Thanks!
EDIT: to make the question clearer.
list1= {{a,b,c,{d,e,f},10,21},{m,n,p,{r,s,t},14,64}}
list2= {{m,n,p,{r,s,t},12},{a,b,c,{d,e,f},16}}
I would like to obtain:
{{a,b,c,{d,e,f},10,21,16},{m,n,p,{r,s,t},14,64,12}}
Thanks!