caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Remi VANICAT <vanicat@labri.u-bordeaux.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Débutant :)
Date: 22 Oct 2001 08:04:21 +0200	[thread overview]
Message-ID: <ya3hessnrbu.dlv@serveur1-1.labri.u-bordeaux.fr> (raw)
In-Reply-To: <ya3n12knsa5.dlv@serveur1-1.labri.u-bordeaux.fr>

Remi VANICAT <vanicat@labri.u-bordeaux.fr> writes:

> "AgEnT007" <agent007-fr@wanadoo.fr> writes:
> 
> > Bonjour à tous,
> > je viens de me mettre cette aprés midi mëme au language CAML et je bute deja sur un exemple que j'ai trouvé :)
> > 
> > voici ce que j'ai:
> > 
> > let rec exemple_1 f a l =
> > if l = [] then a 
> > else exemple_1 f ( f a (List.hd l)) (List.tl l) ;;
> > 
> > j'ai compris l'utilité d'une telle declaration mais pas celle du
> > < a > qui se trouve à la 3eme ligne. 
> > Quelqu'un pourrait t'il m'éclairer sur la troisieme ligne?
> 
> si l = [1; 2; 3; 4; 5; 6; 7; 8; 9]
> 
> alors exemple_1 f a l va calculer
> 
> (f (f (f (f ... (f (f a 9) 8) ...4) 3) 2) 1)

mais qu'est ce que je raconte ? ce que ça calcule c'est

(f (f (f (f ... (f (f a 1) 2) ...6) 7) 8) 9)

en effet

exemple_1 f a [1; 2; 3; 4; 5; 6; 7; 8; 9] =
exemple_1 f (f a 1) [2; 3; 4; 5; 6; 7; 8; 9] =
exemple_1 f (f (f a 1) 2) [ 3; 4; 5; 6; 7; 8; 9] =
....

-- 
Rémi Vanicat
vanicat@labri.u-bordeaux.fr
http://dept-info.labri.u-bordeaux.fr/~vanicat
-------------------
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


      reply	other threads:[~2001-10-22  6:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-21 22:50 AgEnT007
2001-10-22  5:43 ` Remi VANICAT
2001-10-22  6:04   ` Remi VANICAT [this message]

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=ya3hessnrbu.dlv@serveur1-1.labri.u-bordeaux.fr \
    --to=vanicat@labri.u-bordeaux.fr \
    --cc=caml-list@inria.fr \
    /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).