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 PAA06303; Wed, 18 Jul 2001 15:54:50 +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 PAA06299 for ; Wed, 18 Jul 2001 15:54:49 +0200 (MET DST) Received: from femail13.sdc1.sfba.home.com (femail13.sdc1.sfba.home.com [24.0.95.140]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f6IDsmX07479 for ; Wed, 18 Jul 2001 15:54:49 +0200 (MET DST) Received: from home.com ([24.20.120.160]) by femail13.sdc1.sfba.home.com (InterMail vM.4.01.03.20 201-229-121-120-20010223) with ESMTP id <20010718135447.XHJM20529.femail13.sdc1.sfba.home.com@home.com> for ; Wed, 18 Jul 2001 06:54:47 -0700 Message-ID: <3B559663.14707D73@home.com> Date: Wed, 18 Jul 2001 08:00:03 -0600 From: Jay Riddle X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.4-4GB i586) X-Accept-Language: en MIME-Version: 1.0 To: caml-list@inria.fr Subject: [Caml-list] Mapping onto lists Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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? 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];; --JayR x8-1335 ------------------- 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