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: -- (:)
From: jrouquie@e...
Subject: Re: [Caml-list] removing an item from a list efficiently

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

It's guaranteed in OCaml that when you have a pointer to the head of a list, 
the tail won't be modified.
So you have to rebuild at least a sublist with all the elements before the one 
you want to move. Or you can implement linked lists that doesn't meet the first 

Jean-Baptiste Rouquier.

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