Imagine we have a list with some hierarchical structure:
list = {{{2,3},{2,4}},{{{3,4}}},{{5,6},{7,8}}};
Which we then flatten to some level in order to process the data points:
Flatten[list,1]
>> {{2, 3}, {2, 4}, {3, 4}, {5, 6}, {7, 8}}
We then do "something" to change the value of the elements in the list, without increasing or decreasing the number of elements:
>> {{5*10^9, 3}, {2, 4}, {3, 4}, {191991, 6}, {7, 8}}
Can we reverse the flattening procedure to go back to a list of the form:
>> {{{5*10^9,3},{2,4}},{{{3,4}}},{{191991,6},{7,8}}};
Partition
is essentially the inverse ofFlatten
$\endgroup$Internal-Deflatten
is also a candidate for the inverse ofFlatten
, and is worth mentioning :). See Szabolcs answer in the Q&A about undocumented functions. But yeah I guess it doesn't really help. $\endgroup$