tp7 exo5
This commit is contained in:
parent
e5044b4fe2
commit
9aad4d3cba
13
tp7/exo5.ml
13
tp7/exo5.ml
@ -32,3 +32,16 @@ let rec inserer_lc l i x = match l,i with
|
|||||||
| {suivant=Some s;_}, i ->
|
| {suivant=Some s;_}, i ->
|
||||||
inserer_lc s (i-1) x
|
inserer_lc s (i-1) x
|
||||||
| _ -> invalid_arg ""
|
| _ -> 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 ""
|
||||||
|
;;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user