caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Sven <luther@dpt-info.u-strasbg.fr>
To: Johann Spies <jspies@maties.sun.ac.za>
Cc: ocaml mailing list <caml-list@inria.fr>
Subject: Re: [Caml-list] Please help a newbie
Date: Thu, 2 Aug 2001 15:05:30 +0200	[thread overview]
Message-ID: <20010802150530.A9038@dpt-info.u-strasbg.fr> (raw)
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

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


  parent reply	other threads:[~2001-08-02 13:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-02 13:42 Johann Spies
2001-08-02 12:54 ` Frank Atanassow
2001-08-02 13:01 ` Francois Thomasset
2001-08-02 13:25   ` Francois Thomasset
2001-08-02 13:05 ` Sven [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-08-03 10:58 Johann Spies
2001-08-03 18:23 ` [Caml-list] Please help a newbie md5i
2001-08-05 21:37   ` John Max Skaller
2001-08-02 13:37 Dave Berry
2001-08-02 16:08 ` Brian Rogoff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010802150530.A9038@dpt-info.u-strasbg.fr \
    --to=luther@dpt-info.u-strasbg.fr \
    --cc=caml-list@inria.fr \
    --cc=jspies@maties.sun.ac.za \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).