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 PAA15971; Thu, 2 Aug 2001 15:05:08 +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 PAA15967 for ; Thu, 2 Aug 2001 15:05:07 +0200 (MET DST) Received: from dpt-info.u-strasbg.fr (dpt-info.u-strasbg.fr [130.79.44.193]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f72D57X23024 for ; Thu, 2 Aug 2001 15:05:07 +0200 (MET DST) Received: (from luther@localhost) by dpt-info.u-strasbg.fr (8.9.3/8.9.3) id PAA09063; Thu, 2 Aug 2001 15:05:30 +0200 Date: Thu, 2 Aug 2001 15:05:30 +0200 From: Sven To: Johann Spies Cc: ocaml mailing list Subject: Re: [Caml-list] Please help a newbie Message-ID: <20010802150530.A9038@dpt-info.u-strasbg.fr> References: <87lml2a896.fsf@#maties.sun.ac.za> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: <87lml2a896.fsf@#maties.sun.ac.za>; from jspies@maties.sun.ac.za on Thu, Aug 02, 2001 at 01:42:13PM +0000 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, Aug 02, 2001 at 01:42:13PM +0000, Johann Spies wrote: > I have read a lot of tutorials and examples and am now trying to write > something myself. My problem will show that I do not understand a > basic thing in functional programming. I will appreciate some help on > this. > > The following illustrates my problem: > > ------------------ > $ ocaml > Objective Caml version 3.01 > > # let lys = ['a';'b';'c'];; > val lys : char list = ['a'; 'b'; 'c'] > # let wys_dit woord = print_string woord;; > val wys_dit : string -> unit = > # let rec wys_die_lys l = function maybe this should be : let rec wys_die_lys function > [] -> [] > | h :: t -> wys_dit h :: wys_die_lys l t;; and here ... wye_die_lys t;; > val wys_die_lys : 'a -> string list -> unit list = here you have a function taking a first argument of type 'a, thorwing it away and using a second argument. > # wys_die_lys lys;; > - : string list -> unit list = trye wys_die_lys () lys for example. > # wys_die_lys ['x','y','z'];; > - : string list -> unit list = Same here. Hope this helped you ... Friendly, Sven Luther ------------------- 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