vault backup: 2023-10-09 13:15:29
This commit is contained in:
parent
2749a5ed0e
commit
9e34a76dae
@ -110,14 +110,14 @@ let maximum = function
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Exercise 2.1
|
## 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;;
|
||||||
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user