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 NAA14369; Thu, 2 Aug 2001 13:42:26 +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 NAA14361 for ; Thu, 2 Aug 2001 13:42:17 +0200 (MET DST) Received: from maties1.sun.ac.za (maties1.sun.ac.za [146.232.128.1]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f72BgFr22986 for ; Thu, 2 Aug 2001 13:42:16 +0200 (MET DST) Received: from bywoner.sun.ac.za ([146.232.129.121] helo=bywoner) by maties1.sun.ac.za with esmtp (Exim 3.31 #1) id 15SGri-0001qW-00 for caml-list@inria.fr; Thu, 02 Aug 2001 13:42:10 +0200 Received: from js by bywoner with local (Exim 3.22 #1 (Debian)) id 15SIjt-0001ab-00 for ; Thu, 02 Aug 2001 13:42:13 +0000 To: ocaml mailing list Subject: [Caml-list] Please help a newbie From: Johann Spies Date: 02 Aug 2001 13:42:13 +0000 Message-ID: <87lml2a896.fsf@#maties.sun.ac.za> User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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 [] -> [] | h :: t -> wys_dit h :: wys_die_lys l t;; val wys_die_lys : 'a -> string list -> unit list = # wys_die_lys lys;; - : string list -> unit list = # wys_die_lys ['x','y','z'];; - : string list -> unit list = ------------------------------------------------ Now my question: I expected wys_die_lys lys to print out a b c and wys_die_lys ['x','y','z'] to print x y z Why did this not happen? Johann -- Johann Spies Telefoon: 021-808 4036 Informasietegnologie, Universiteit van Stellenbosch "All scripture is given by inspiration of God, and is profitable for doctrine, for reproof, for correction, for instruction in righteousness;" II Timothy 3:16 ------------------- 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