diff --git a/tp7/dune b/tp7/dune index bc07fb4..4eae844 100644 --- a/tp7/dune +++ b/tp7/dune @@ -6,6 +6,10 @@ (name exo5) (modules exo5) ) +(library + (name exo6) + (modules exo6) +) (library (name exo9) (modules exo9) diff --git a/tp7/exo6.ml b/tp7/exo6.ml new file mode 100644 index 0000000..d235fc7 --- /dev/null +++ b/tp7/exo6.ml @@ -0,0 +1,17 @@ +let creer_lcp () = [];; + +let taille_lcp = List.length;; + +let acces_lcp = List.nth;; + +let rec inserer_lcp l i x = match l,i with + | l, 0 -> x::l + | x::q, i -> x::inserer_lcp q (i-1) x + | _ -> invalid_arg "" +;; + +let rec retirer_lcp l i = match l,i with + | _::q, 0 -> q + | x::q, i -> x::retirer_lcp q (i-1) + | _ -> invalid_arg "" +;;