vault backup: 2023-10-30 10:14:11

This commit is contained in:
Louis Gallet 2023-10-30 10:14:11 +01:00
parent 3f39d3057c
commit 0a0932f378
Signed by: lgallet
SSH Key Fingerprint: SHA256:qnW7pk4EoMRR0UftZLZQKSMUImbEFsiruLC7jbCHJAY
2 changed files with 22 additions and 16 deletions

View File

@ -78,7 +78,8 @@
} }
], ],
"direction": "horizontal", "direction": "horizontal",
"width": 300 "width": 300,
"collapsed": true
}, },
"right": { "right": {
"id": "b83c16dd7908c658", "id": "b83c16dd7908c658",

35
Exam.md
View File

@ -1,16 +1,21 @@
## Multiple insertion ## Multiple insertion
```Ocaml ```
let insert_mult n x lst = # let insert_mult n x lst =
if n <= 0 then if n <= 0 then
invalid_arg "insert_mult: n must be > 0" invalid_arg "insert_mult: n must be > 0"
else else
match lst with let rec aux count = function
| [] -> [] | [] -> []
| z::f -> | e::t ->
let aux count = function if (count = n) then
| [] -> x e :: x :: aux 1 t
| e::t -> else
if (count = n) then e :: aux (count + 1) t
e :: x :: t in
else aux (count + 1) t match lst with
in aux 1 t | [] -> []
| z::f -> z :: aux 0 f
val insert_mult: int -> 'a -> 'a list -> 'a list = <fun>
```