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 SAA08672; Wed, 18 Jul 2001 18:11:39 +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 SAA08668 for ; Wed, 18 Jul 2001 18:11:38 +0200 (MET DST) Received: from mail.cs.uu.nl (sunset.cs.uu.nl [131.211.80.32]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f6IGBcX09917 for ; Wed, 18 Jul 2001 18:11:38 +0200 (MET DST) Received: from bentobox (bentobox.cs.uu.nl [131.211.80.235]) by mail.cs.uu.nl (Postfix) with SMTP id BE3CB4521; Wed, 18 Jul 2001 18:11:37 +0200 (MET DST) From: "Frank Atanassow" To: "Jay Riddle" , Subject: RE: [Caml-list] Mapping onto lists Date: Wed, 18 Jul 2001 18:11:56 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <3B559663.14707D73@home.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2479.0006 Importance: Normal Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > Is there any way to combine these two functions(map and my_map) so > that the following will work? In short, no, but perhaps it will help to point out that: my_map x = map (fun f -> f x) Maybe it is possible in G'Caml, though. --- Frank Atanassow, Information & Computing Sciences, Utrecht University Padualaan 14, PO Box 80.089, 3508TB Utrecht, The Netherlands Tel +31 (0)30 253-3261 Fax +31 (0)30 251-3791 --- > let plus x y = x + y;; > > let rec map f = function > [] -> [] > | head::tail -> let r = f head in r :: map f tail;; > > map (plus 2) [10; 100; 100];; > - : int list = [12; 102; 1002] > > let rec my_map f = function > [] -> [] > | head::tail -> let r = head f in r :: my_map f tail;; > > my_map 10 [plus 2; plus 4; plus 7];; > - : int list = [12; 14; 17] > > (* Combined mapping function *) > combined_map 2 [plus 10; plus 100; plus 1000];; > combined_map (plus 2) [10; 100; 100];; ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr