I have a nested list with elements that are lists themselves. I want to find all the sublists and flatten them as a single list:
For example:
[[a], [b,[c,[d,e]]], [f,g]]
I want to have a list containing all existing sublists (flattened) in the original list, that is:
[[a], [b,c,d,e], [c,d,e], [d,e], [f,g]]
I used a recursive function but the problem is that I get nested sublists again which is not what I want. Also my question is not about flattening irregular lists.