* [Caml-list] Débutant :)
@ 2001-10-21 22:50 AgEnT007
2001-10-22 5:43 ` Remi VANICAT
0 siblings, 1 reply; 3+ messages in thread
From: AgEnT007 @ 2001-10-21 22:50 UTC (permalink / raw)
To: caml-list
[-- Attachment #1: Type: text/plain, Size: 494 bytes --]
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?
Merci à tous, bonne nuit
Agent.
ps: désolé si je n'ai pas été clair :)
[-- Attachment #2: Type: text/html, Size: 1315 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Débutant :)
2001-10-21 22:50 [Caml-list] Débutant :) AgEnT007
@ 2001-10-22 5:43 ` Remi VANICAT
2001-10-22 6:04 ` Remi VANICAT
0 siblings, 1 reply; 3+ messages in thread
From: Remi VANICAT @ 2001-10-22 5:43 UTC (permalink / raw)
To: caml-list
"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)
cette fonction a une utilité.
J'espère que c'est clair....
--
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Débutant :)
2001-10-22 5:43 ` Remi VANICAT
@ 2001-10-22 6:04 ` Remi VANICAT
0 siblings, 0 replies; 3+ messages in thread
From: Remi VANICAT @ 2001-10-22 6:04 UTC (permalink / raw)
To: caml-list
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-10-22 6:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-21 22:50 [Caml-list] Débutant :) AgEnT007
2001-10-22 5:43 ` Remi VANICAT
2001-10-22 6:04 ` Remi VANICAT
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox