Skip to content
Prev 208724 / 398500 Next

How to flatten a tree (based on list) to a certain depth?

On Wed, Feb 3, 2010 at 1:47 PM, Bert Gunter <gunter.berton at gene.com> wrote:
I did. You said to use a loop. I think flatten a tree to a certain
level shouldn't be done with a loop. Loop is a way used in the
imperative programming style. Flatten is in the functional programming
style. I don't think that it is a good idea to mix the two.

Also, the flatten a tree to a certain level operation should be
extracted to a well defined function for re-usability. Using a loop is
a bad idea to enhance re-usability.