From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA25795; Fri, 7 Nov 2003 10:49:13 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA26209 for ; Fri, 7 Nov 2003 10:49:12 +0100 (MET) Received: from mailhost.ens-lyon.fr (pluvier.ens-lyon.fr [140.77.167.5]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id hA79nB125036 for ; Fri, 7 Nov 2003 10:49:11 +0100 (MET) Received: by mailhost.ens-lyon.fr with scanned-ok (Exim 3.35 #1 (Debian)) id 1AI3Es-0002EN-00 for ; Fri, 07 Nov 2003 10:49:10 +0100 Received: from mailhost.ens-lyon.fr ([127.0.0.1]) by localhost (pluvier [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 07018-04 for ; Fri, 7 Nov 2003 10:49:09 +0100 (CET) Received: from mouette.ens-lyon.fr ([140.77.167.4]) by mailhost.ens-lyon.fr with esmtp (Exim 3.35 #1 (Debian)) id 1AI3Eq-0002Cg-00 for ; Fri, 07 Nov 2003 10:49:08 +0100 Received: from www-data by mouette.ens-lyon.fr with local (Exim 3.35 #1 (Debian)) id 1AI3Eq-0001RI-00 for ; Fri, 07 Nov 2003 10:49:08 +0100 To: Caml Mailing List Subject: Re: [Caml-list] removing an item from a list efficiently Message-ID: <1068198547.3fab6a9327eb0@mouette.ens-lyon.fr> Date: Fri, 07 Nov 2003 10:49:07 +0100 (CET) From: jrouquie@ens-lyon.fr References: <483F0AC5-1105-11D8-AC71-000393CFE6B8@spy.net> In-Reply-To: <483F0AC5-1105-11D8-AC71-000393CFE6B8@spy.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: IMP/PHP IMAP webmail program 2.2.6 X-Originating-IP: 140.77.194.16 X-Virus-Scanned: by amavisd-new-20030616-p5 (Debian) at ens-lyon.fr X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 ens-lyon:01 linked:01 linked:01 ocaml:01 pointer:03 tail:03 rebuild:03 implement:05 implement:05 lists:91 removing:10 elements:12 doesn't:12 efficiently:15 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > 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