Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Please help a newbie
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Sven <luther@d...>
Subject: Re: [Caml-list] Please help a newbie
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 = <fun>
> # 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 = <fun>

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 = <fun>

trye wys_die_lys () lys for example.

> # wys_die_lys ['x','y','z'];;
> - : string list -> unit list = <fun>

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