On Tue, Jun 23, 2020 at 11:26:27AM -0700, Michael Forney wrote:
> Thanks for testing this out, Richard.
> 
> On 2020-06-23, Richard Ipsum <richardip...@vx21.xyz> wrote:
> > I don't feel qualified to criticise the overall design, but do we not still
> > need a way to specify whether traversal should be pre-order or post-order?
> > I figure this is what DIRFIRST was for right?
> 
> The effective traversal order can be controlled by structuring your
> recursor function to call recursedir() at the beginning or end.
> 
> DIRFIRST was only useful because a top-level directory was handled
> specially by recurse. Normally, recurse() does not "visit" its
> argument at all, only its children. For D/f, the call structure was
> something like this for DIRFIRST:
> 
[snip]
>                               
> As you can see, the DIRFIRST flag is only used at the toplevel for
> bootstrapping. In other cases, it is ignored, since the function is
> just structured differently depending on whether it needs the children
> processed first or last:
> 
>       fn(D)
>               do something with D
>               recurse(D)
> 
> or
> 
>       fn(D)
>               recurse(D)
>               do something with D

Makes sense, thanks for the explanation!

Thanks,
Richard

Reply via email to