Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] removing an item from a list efficiently
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-11-09 (01:13)
From: Dustin Sallings <dustin@s...>
Subject: Re: [Caml-list] removing an item from a list efficiently

On Nov 8, 2003, at 1:16, Stefano Zacchiroli wrote:

> I still think that lists, no matter if single or doubly linked aren't a
> good structure for your cache, anyway ...

	I'm using a Hashtbl for indexing the linked list which is used for 
maintaining the sequence.  It should be O(1).

>> 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 ...

	It is, thank you.  The ``and'' thing was not obvious to me.  Still 

Dustin Sallings

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: