How do you implement a recursive walker of a tree with a lazy range?

Philippe Sigaud philippe.sigaud at gmail.com
Wed Oct 30 11:55:41 PDT 2013


On Wed, Oct 30, 2013 at 7:09 PM, Andrej Mitrovic <andrej.mitrovich at gmail.com
> wrote:

> On 10/30/13, Philippe Sigaud <philippe.sigaud at gmail.com> wrote:
> > Does that syntax come with DMD 2.064? The (T) part, I mean.
>
> Yes.
>

Ah, that's cool! I've been waiting for that one for years.



>
> Glad to see you here btw, do you have your own solution to the problem?
>

 As Benjamin, I used an internal stack. But that was years ago, let me see.

https://github.com/PhilippeSigaud/dranges/blob/master/treerange.d#L185
or, for graphs:
https://github.com/PhilippeSigaud/dranges/blob/master/graphrange.d#L25

Hmm, what I did there doesn't seem really lazy. I guess with today Phobos
and DMD it's possible to have far less allocations.
(that code dates from 2009-2011)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20131030/7794509b/attachment.html>


More information about the Digitalmars-d-learn mailing list