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

Jean-Baptiste Rouquier.

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