vault backup: 2023-10-26 20:39:04
This commit is contained in:
parent
6c981dc1c5
commit
7b5e822d93
@ -1,2 +1,11 @@
|
|||||||
```Ocaml
|
```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;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user