From: Richard Jones <rich@annexia.org>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Creating a tree type
Date: Mon, 7 Feb 2005 11:58:14 +0000 [thread overview]
Message-ID: <20050207115814.GA22127@furbychan.cocan.org> (raw)
In-Reply-To: <ad8cfe7e050207034127df7f73@mail.gmail.com>
On Tue, Feb 08, 2005 at 12:41:37AM +1300, Jonathan Roewen wrote:
> Hi,
>
> 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? Is this
> an example of when ocaml's OO side would be more useful?
>
> Basically, I'm creating a UI for my OS; since events will typically
> bubble from leaf nodes up through their ancestors until either the
> event has been handled or have reached the root node, being able to
> reference the parent node efficiently (and easily) is a requirement.
>
> I've tried a recursive type, but both the defintion and code to make
> use of it is damn ugly and complicated--there just has to be a better
> way to do this sort of thing nicely in ocaml.
I had a similar problem - threading mail using JWZ's threading
algorithm. It requires you maintain a tree with pointers to parent
and/or root nodes. You can find the implementation (not by me, but by
Radu Grigore) in
http://sandbox.merjis.com/_file/cocanwiki-1.3.8.tar.gz , in file
scripts/lib/cocanwiki_mail.ml
Rich.
--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com
next prev parent reply other threads:[~2005-02-07 11:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-07 11:41 Jonathan Roewen
2005-02-07 11:58 ` Richard Jones [this message]
[not found] ` <200502071601.01981.jon@jdh30.plus.com>
2005-02-09 4:28 ` Jonathan Roewen
2005-02-09 6:43 ` Pierre Casteran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050207115814.GA22127@furbychan.cocan.org \
--to=rich@annexia.org \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox