From f1743bfc947e0f0205c037cdc01a3a340f278ddc Mon Sep 17 00:00:00 2001 From: Louis Date: Mon, 9 Oct 2023 14:52:04 +0200 Subject: [PATCH] vault backup: 2023-10-09 14:52:04 --- Algo/Courses/Chapter 6 - Lists (Exercises).md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Algo/Courses/Chapter 6 - Lists (Exercises).md b/Algo/Courses/Chapter 6 - Lists (Exercises).md index db3e4ee..47d5afa 100644 --- a/Algo/Courses/Chapter 6 - Lists (Exercises).md +++ b/Algo/Courses/Chapter 6 - Lists (Exercises).md @@ -151,3 +151,16 @@ let rec delete x = function ## Exercise 3.3 ```Ocaml +# let rec length l = + if l = [] then 0 + else + let e::t = l in + 1 +. length t;; + +#let rec insert x i list = + if x < 0 then + invalid_arg "negative rank" + else if i > length list then + failwith "Out of bound" + else + \ No newline at end of file