Appel initial : Le premier appel de la fonction.
Appel initial : Le premier appel de la fonction.
Appel initial : Le premier appel de la fonction.
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Exercices complémentaires :<br />
• Inversion d'une liste :<br />
let inverse liste =<br />
let rec auxiliaire accumu<strong>la</strong>teur liste =<br />
match liste with<br />
|[] -> accumu<strong>la</strong>teur<br />
|h::t -> auxiliaire (h::accumu<strong>la</strong>teur) t<br />
in<br />
auxiliaire [] liste;;<br />
val inverse : 'a list -> 'a list = <br />
auxiliaire liste h t liste=[] accumu<strong>la</strong>teur h::accumu<strong>la</strong>teur Résultat<br />
[5;4;3;2] Retour 5<br />
<strong>Appel</strong> 1 [2;3;4;5] 2 [3;4;5] false [] [2] [5;4;3;2] Retour 4<br />
<strong>Appel</strong> 2 [3;4;5] 3 [4;5] false [2] [3;2] [5;4;3;2] Retour 3<br />
<strong>Appel</strong> 3 [4;5] 4 [5] false [3;2] [4;3;2] [5;4;3;2] Retour 2<br />
<strong>Appel</strong> 4 [5] 5 [] false [4;3;2] [5;4;3;2] [5;4;3;2] Retour 1<br />
<strong>Appel</strong> 5 [] true [5;4;3;2]