From dd1befc4ef2da0b1041aa01e2304ff787005cccc Mon Sep 17 00:00:00 2001 From: Louis Date: Mon, 30 Oct 2023 10:26:22 +0100 Subject: [PATCH] vault backup: 2023-10-30 10:26:22 --- Exam.md | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/Exam.md b/Exam.md index 68f25cb..934abb2 100644 --- a/Exam.md +++ b/Exam.md @@ -1,20 +1,12 @@ ## Multiple insertion ``` -# let insert_mult n x lst = - if n <= 0 then - invalid_arg "insert_mult: n must be > 0" - else - let rec aux count = function - | [] -> [] - | e::t -> - if (count = n) then - e :: x :: aux 1 t - else - e :: aux (count + 1) t - in - match lst with - | [] -> [] - | z::f -> z :: aux 0 f -val insert_mult: int -> 'a -> 'a list -> 'a list = +# let rec remove_x x = function + | [] -> [] + | e::t -> + if (e = x) then + remove_x x t + else e::remove_x x t + +val remove_x: 'a -> 'a list -> 'a list ```