Browse thread
[newbie] Define and use records in sum types
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Markus Mottl <mottl@m...> |
| Subject: | Re: Recursive Sets? |
On Wed, 02 Aug 2000, Michael Welsh Duggan wrote:
> I have been trying to create a recursive type which can express sets
> of itself. The following code is not meant to be correct (it isn't),
> but hopefully expresses the sort of thing I want to do. Can someone
> throw some ideas at me?
I am afraid, but it is not possible to have mutually recursive module
and type definitions. See the following entry in the archive:
http://pauillac.inria.fr/bin/wilma_hiliter/caml-list/199901/msg00016.html?line=47#hilite
I don't know what exactly you want to do. Some time ago I implemented a
referentially transparent directory service that might be similar to what
you want to implement, e.g.:
+-root-+
/ | | \
a b \ c
| / f
d e /|\
g h i
It is possible to update nodes directly without losing persistence. E.g.:
let dir1 = (* directory as above,
the "current working directory" is "root" *) in
let dir2 = Dir.cd_path dir1 ["f"; "h"; "x"] ...
This will keep "dir1" unchanged, but "dir2" will look as follows (the
CWD will be "root/f/h/x"):
+-root-+
/ | | \
a b \ c
| / f
d e /|\
g h i
|
x
You can parameterize the directory over arbitrary ordered elements. If it
is something like this you need, I could place it online (though, it is
part of a larger project that I'll release in a few weeks, anyway - not
much time right now)...
Regards,
Markus Mottl
--
Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl