This may be a rather strange question. I will try to create a sort of minimal working example.

Suppose that I have two lists, list1 and list2. Both list1 and list2 are ragged, and they both have multiple levels. However, list1 and list2 have the same number of elements, and their level distributions/arrangements are the same. For example:

list1 = {{{a, b, c}, {d, e, f, g, h}, {i, j}}, {{AA, BB}, {CC, DD, EE}}};
list2 = {{{1, 2, 3}, {4, 5, 6, 7, 8}, {9, 10}}, {{11, 12}, {13, 14, 15}}};


I would like to "thread" or "transpose" list1 and list2 to obtain list3, which has the same basic structure but with corresponding elements paired:

list3 =
{{{{a, 1}, {b, 2}, {c, 3}}, {{d, 4}, {e, 5}, {f, 6}, {g, 7}, {h, 8}}, {{i, 9}, {j, 10}}},
{{{AA, 11}, {BB, 12}}, {{CC, 13}, {DD, 14}, {EE, 15}}}}


Is there a relatively simple way to obtain list3 from list1 and list2, apart from using a complicated nesting of Table commands? Transpose, Thread, and MapThread all seem potentially useful, but not entirely straightforward for such "deep," ragged lists. Do you have any suggestions? Thanks for your time.

-

## marked as duplicate by Leonid Shifrin, Sjoerd C. de Vries, R. M.♦Jul 25 '13 at 18:56

Duplicates: (6102), (9012), (17400) – Mr.Wizard Jul 25 '13 at 16:34
@Mr.Wizard For this one, my memory has let me down - I was sure this wasn't asked before. Voting to close, then. – Leonid Shifrin Jul 25 '13 at 18:06

Here is one way:

ClearAll[add];

add[list1, list2]