Fri Jul 14 09:30:14 CEST 2000
On 13 Jul 2000, Mickael Remond wrote:
>>>>>> "Ulf" == Ulf Wiger <> writes:
> Ulf> What are the criteria for insertion? Are there split/merge thresholds?
> Ulf> Why is for example 4 a child of 3?
> Ulf> In any case, I wrote a walk/1 function and an insert/3 function,
> Ulf> assuming that you need to identify the parent node when you insert.
> Ulf> The walk/1 function is really tree_to_list/1.
>This is exactly what I had in mind. So well done. Your recursion is
>impressive. Is your walk_insert / walk_insert1 a common pattern ?
Uhm... I don't know. It's pretty common to spread the recursion over
multiple functions; sometimes it's done by using a higher-order
function inside the main function -- then you won't have the naming
problem, as the higher-order function is anonymous...
Looking at the code again, I see that I didn't have to name the second
function walk_insert1, as it has a different number of arguments.
In those cases, I normally let the name stay unchanged. Sloppy of me.
If I can't keep the name, or come up with a logical other name, I slap
a 1 to the original name.
Ulf Wiger tfn: +46 8 719 81 95
Network Architecture & Product Strategies mob: +46 70 519 81 95
Ericsson Telecom AB, Datacom Networks and IP Services
Varuvägen 9, Älvsjö, S-126 25 Stockholm, Sweden
More information about the erlang-questions