I have a list which looks some thing like this
{a1, a2, a3, a4, a5, a6, a7, a8, a9, a10}
Now I want to split it according to lengths {1,2,3,4}
so that I would have
{{a1},{ a2, a3}, {a4, a5, a6},{ a7, a8, a9, a10}}
and I want to apply the rule with itself. For example: after rule application, the answer should become
{{a1},{a2->a3},{a4->a5->a6},{a7->a8->a9->a10}}.
I have tried to use Split
and Partition
function but not getting the desired result.
Is there any other function that accomplishes this? If not how can I do this?