From 9aad4d3cbaf228ce0706d3ef109c521b40b9b789 Mon Sep 17 00:00:00 2001 From: Arkitu Date: Thu, 15 Jan 2026 20:55:39 +0100 Subject: [PATCH] tp7 exo5 --- tp7/exo5.ml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tp7/exo5.ml b/tp7/exo5.ml index f05f711..6ac1ace 100644 --- a/tp7/exo5.ml +++ b/tp7/exo5.ml @@ -32,3 +32,16 @@ let rec inserer_lc l i x = match l,i with | {suivant=Some s;_}, i -> inserer_lc s (i-1) x | _ -> invalid_arg "" +;; + +let rec retirer_lc l i = match l,i with + | {suivant=Some s;_}, 0 -> + l.tete <- s.tete; + l.suivant <- s.suivant + | {suivant=None;_}, 0 -> + l.tete <- None + | {suivant=Some {suivant=s;_};_}, 1 -> + l.suivant <- s + | {suivant=Some s;_}, i -> retirer_lc s (i-1) + | _ -> invalid_arg "" +;;