vault backup: 2023-10-13 14:58:36

This commit is contained in:
2023-10-13 14:58:36 +02:00
parent e29bce3e13
commit b79c8ba9a0
2 changed files with 18 additions and 5 deletions

View File

@ -183,4 +183,18 @@ val delete: int -> 'a list -> list = <fun>
else if i > length list then
failwith "Out of bound"
else
(* Correction *)
let insert_nth w i list =
if i <= 0 then
invalid_arg "negative rank"
else
let rec insrec i = function
[] -> if i > 1 then
failwith "out of bound"
else
x::t
| e::E when i = 1 -> x::e::t
| e::t -> e::insrec (i - 1) t
in insrec i list;;