Timeline for Remove empty elements in nested list
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 28, 2021 at 11:10 | vote | accept | Nobody | ||
Dec 25, 2021 at 15:29 | comment | added | Bob Hanlon |
Your FixedPoint approach is equivalent to pts //. {} :> Nothing , i.e., using ReplaceRepeated
|
|
Dec 25, 2021 at 14:43 | comment | added | Alexei Boulbitch |
I am not familiar with skeletonizing. However, as I see your desired form of the result, maybe a good idea would be to first apply Flatten to the list and then the operation that I proposed.
|
|
Dec 25, 2021 at 14:09 | comment | added | Nobody |
It almost achieves my aim! But as mentioned in my post, pts is a really long list, which even include a skeletonizing OutputSizeLimit Skeleton[100], for example. This makes your method not work for those skeletonized sub-lists. Is there any way to make it take effect into the ignored elements, instead of must clicking show more below the long list to expand it before applying FixedPoint . Thank you very much!
|
|
Dec 25, 2021 at 13:49 | comment | added | Nobody |
Please note there are 4 layers of {} before reaching the non-empty elements in my example. Your answer actually give the same result as DeleteCases[pts, {}, 3] for my example.
|
|
Dec 25, 2021 at 13:45 | history | edited | Alexei Boulbitch | CC BY-SA 4.0 |
added 387 characters in body
|
Dec 25, 2021 at 13:38 | history | answered | Alexei Boulbitch | CC BY-SA 4.0 |