vault backup: 2023-10-26 20:39:04

This commit is contained in:
Louis Gallet 2023-10-26 20:39:04 +02:00
parent 6c981dc1c5
commit 7b5e822d93
Signed by: lgallet
SSH Key Fingerprint: SHA256:qnW7pk4EoMRR0UftZLZQKSMUImbEFsiruLC7jbCHJAY

View File

@ -1,2 +1,11 @@
```Ocaml
let rec insert_post x f = function
| [] -> Failwith "x cannot be inserted"
| e::t -> if f e then e::x::t else y::insert_post x f t;;
let pos_max lst = let x = 1 in match lst with
| [] -> invalid_arg "post_max: empty list"
| e::[] -> e
| e1::e2::t -> if e2 > e1 then
x = x + 1;
e2::pos_max else e1::t;;