Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Brian Hurt <bhurt@s...>
Subject: Re: [Caml-list] removing an item from a list efficiently
On Fri, 7 Nov 2003, Dustin Sallings wrote:

> 
> 	I'm trying to implement an LRU cache and I'm using a list to keep up 
> with the accesses.  I'm using filter to remove the item for 
> repositioning it.  That's very slow.
> 
> 	Is there a better way to efficiently move a list item to the front, or 
> should I just implement a linked list to meet my requirements?
> 
> 

If delete needs to be fast, consider using a different data structure.  
Look at the Set, Map, and Hashtbl libraries.

Brian


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