Recently, I have been reading Mathematica program that written by many advanced Mathematica user, like Mr.Wizard, J.M., Kuba,etc to improve my programming capacity
In the On generalizing Partition[] (with offsets) to sublists of unequal length
I read the program of Mr.Wizard about dpCyclic
which owns a line code shown as below:
MapThread[blocks[[All, # ;; #2]] &, ranges] ~Flatten~ {2, 1}
I cannot under the useage of Flatten[list,{2,1}]
So I look up the Wolfram Help Documentation
And it has a example:
u = {{a, b}, {c, d}};
Flatten[{{u, 0 u}, {0 u, u}}, {{1, 3}, {2, 4}}] // MatrixForm
Or
Flatten[{{1}, {2, 3}, {3, 4, 5}, {4, 5, 6, 7}}, {{2}, {1}}]
{{1, 2, 3, 4}, {3, 4, 5}, {5, 6}, {7}}
However,I cannot understand their result correctly.
So my question is :
1.How to understand extensional usage of Flatten
?
2.In Flatten[{{1}, {2, 3}, {3, 4, 5}, {4, 5, 6, 7}}, {{2}, {1}}]
,how to use the argument
{{2}, {1}}
correctly, Namely, why I cannot use {{2}, {2}}
?