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 WAA12927; Sun, 10 Aug 2003 22:55:55 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA11696 for ; Sun, 10 Aug 2003 22:55:54 +0200 (MET DST) Received: from mwinf0603.wanadoo.fr (smtp3.wanadoo.fr [193.252.22.25]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h7AKtrT12854 for ; Sun, 10 Aug 2003 22:55:54 +0200 (MET DST) Received: from zofo (Mix-Grenoble-103-2-164.w193-250.abo.wanadoo.fr [193.250.90.164]) by mwinf0603.wanadoo.fr (SMTP Server) with SMTP id 8E47124000A2 for ; Sun, 10 Aug 2003 22:55:51 +0200 (CEST) Message-ID: <00c601c35f81$c2f59480$a45afac1@zofo> From: "Jean-Baptiste Rouquier" To: References: <005d01c35e51$7c927200$6628f9c1@zofo> <20030809165720.GE21525@swordfish> <20030809184851.GA946@localhost> Subject: Re: [Caml-list] Array.filter Date: Sun, 10 Aug 2003 22:55:36 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Loop: caml-list@inria.fr X-Spam: no; 0.00; ens-lyon:01 caml-list:01 unload:01 struct:01 complements:99 accu:01 elt:01 int:01 stack:02 thread:02 module:03 heap:03 library:03 let:04 array:04 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I didn't think I would have any answers ! I prefer reading "worl domination thread", even if I don't have time to help for the moment. Perhaps the really missing thing is one guy to coordinate the work. I have a wish along #unload : the symetric of open, even if the [open] scope is the current struct. So we can [open] a module in the main file, and [close] it in the middle of the same file. > It might help to create a file (mods.ml) with your favorite additions >and modifications to the standard library. I called it Complements in my precedent mail. let filter test a = let result = (Array.fold_left (fun accu elt -> if test elt then elt :: accu else accu) [] a) in Array.of_list (List.rev result) # let _ = filter (fun x -> x mod 2 = 0) [|0; 1; 2; 3; 4; 5|];; - : int array = [|0; 2; 4|] Constant stack but O(n) heap. 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