Browse thread
[Caml-list] removing an item from a list efficiently
[
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: | Stefano Zacchiroli <zack@b...> |
| Subject: | Re: [Caml-list] removing an item from a list efficiently |
[ Please don't Cc:-me, I'm subscribed to this list, as my
Mail-Followup-To header can confirm ]
On Sat, Nov 08, 2003 at 12:49:48AM -0800, Dustin Sallings wrote:
> This is really what I was asking, whether ocaml lists could be
> appropriate.
>
> I'm having difficulty figuring out how to implement a double linked
> list, though. I want something like this:
I still think that lists, no matter if single or doubly linked aren't a
good structure for your cache, anyway ...
> type 'a link = Nothing | Link of 'a t;;
> type 'a t = {
> data: 'a;
> mutable prev: 'a link;
> mutable next: 'a link;
> };;
> But, link and t don't know about each other. How does one go about
> doing this kind of thing in ocaml?
What do you mean? The above declaration isn't correct just because you
have to use an "and" instead of a "type" for the second declaration to
have two mutual recursive types. I don't know if this is really what
you're asking ...
Cheers.
--
^Stefano Zacchiroli -- Master in Computer Science @ Uni. Bologna, Italy$
^zack@{cs.unibo.it,debian.org,bononia.it} -- http://www.bononia.it/zack$
^Frequentando il mio maestro mi ero reso conto [.] che la logica poteva$
^servire a molto a condizione di entrarci dentro e poi di uscirne -Adso$
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners