From 9e34a76dae89694f4310d4dbf09c429a132658a2 Mon Sep 17 00:00:00 2001 From: Louis Date: Mon, 9 Oct 2023 13:15:29 +0200 Subject: [PATCH] vault backup: 2023-10-09 13:15:29 --- Algo/Courses/Chapter 6 - Lists (Exercises).md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Algo/Courses/Chapter 6 - Lists (Exercises).md b/Algo/Courses/Chapter 6 - Lists (Exercises).md index 148dc45..0126433 100644 --- a/Algo/Courses/Chapter 6 - Lists (Exercises).md +++ b/Algo/Courses/Chapter 6 - Lists (Exercises).md @@ -110,14 +110,14 @@ let maximum = function ``` ## Exercise 2.1 +```Ocaml +let rec arithmetic_list n a1 r = + if n <= 0 then [] + else a1 :: arithmetic_list (n - 1) (a1 + r) r;; ``` -let arith_list n a r = - if n < 0 then - invalid_arg "n must be superior to 0" - else if n = 0 then - [] - if n = 1 then - a::[] - else let rec arl = - | +## Exercise 2.2 +```Ocaml +let concatenate_lists lst1 lst2 = + lst1 @ lst2;; +```