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-07 (15:51)
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.


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