in reply to Re: How might I handle a special tree?
in thread How might I handle a special tree?
I thought about AoA, but that is not enought. For example:
[1,2,3,4,5,6,7,8,9]should be converted to something like this:
[1,[2,3,4],5,[6,[7,8,9]]]What is missing in this structure is the placeholder, which will have a group name... that's a new value in the list!
I guess that I could manage the first element in each list as the name of the placeholder, resulting something like this:
[A,1,[B,2,3,4],5,[C,6,[D,7,8,9]]]BTW, while traversing, how could I recognize if current element is a scalar or another list to recurse?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How might I handle a special tree? (updated)
by LanX (Saint) on Dec 07, 2014 at 23:02 UTC | |
by vitoco (Hermit) on Dec 07, 2014 at 23:34 UTC |