English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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 (09:49)
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 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