Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Creating a tree type
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pierre Casteran <pierre.casteran@l...>
Subject: Re: [Caml-list] Creating a tree type
Hello,

Did you look at Huet's zippers ?

http://caml.inria.fr/archives/200304/msg00202.html

Pierre


Selon Jonathan Roewen <jonathan.roewen@gmail.com>:

> On Mon, 7 Feb 2005 16:01:01 +0000, Jon Harrop <jon@jdh30.plus.com> wrote:
> > On Monday 07 February 2005 11:41, Jonathan Roewen wrote:
> > > What would be the best approach to creating a tree type such that at
> > > each node, it has some sort of reference to the parent node...
> >
> > Adding references to the parent of each node in a tree makes the data
> > structure a graph and not a tree.
> >
> > This can be implemented in several ways. However, I strongly recommend that
> > you do not do this to begin with, for several reasons:
>
> Okay, so I realised I could just use a Stack to track a walk through the
> tree...
>
> A couple more questions though:
>
> 1. For the Stack, when I put something in it, is it copied or what?
> How does that work?
>
> 2. How do I make my tree like a hashtable, i.e. modifications are done
> in-place? Some sort of nested Map or something? Using lists to build
> up the tree would cause pain when wanting to modify it. It would also
> seem inefficient to use lists for this particular use case.
>
> Regards,
>
> Jonathan.
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>


-- 
Pierre Casteran
(+33) 540006931

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.