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 WAA28259; Fri, 28 Jun 2002 22:03:32 +0200 (MET DST) 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 WAA28103 for ; Fri, 28 Jun 2002 22:03:31 +0200 (MET DST) Received: from mbg.sphere.ne.jp (mbg.sphere.ne.jp [210.150.254.179]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g5SK3U519807 for ; Fri, 28 Jun 2002 22:03:30 +0200 (MET DST) Received: from localhost (pl743.nas923.o-tokyo.nttpc.ne.jp [210.165.239.231]) by mbg.sphere.ne.jp (Postfix) with ESMTP id 14DB33A262 for ; Sat, 29 Jun 2002 05:03:28 +0900 (JST) In-Reply-To: <20020628193952.GA5829@vincent> References: <20020628193952.GA5829@vincent> Subject: Re: [Caml-list] Removing an element from a list To: caml-list@inria.fr X-Mailer: Mew version 1.94.2 on Emacs 20.7 / Mule 4.1 (AOI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20020629051024V.yoriyuki@mbg.sphere.ne.jp> Date: Sat, 29 Jun 2002 05:10:24 +0900 From: YAMAGATA yoriyuki X-Dispatcher: imput version 991025(IM133) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: Vincent Foley Subject: [Caml-list] Removing an element from a list Date: Fri, 28 Jun 2002 15:39:52 -0400 > I would like to know how to remove an element from a list. For example, > I would like to remove 3 in this list: [1; 2; 3; 4; 5]. How would I do > it? List.filter (fun e -> e <> 3) [1; 2; 3; 4; 5] This creates the new list [1; 2; 4; 5] and does not modify the original [1; 2; 3; 4; 5]. In caml, operations on lists is never destructive (unlike lisp). -- Yamagata Yoriyuki http://www.mars.sphere.ne.jp/yoriyuki/ ------------------- 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