From 7b5e822d936214258dfd1a8f4db9009e0dd66e77 Mon Sep 17 00:00:00 2001 From: Louis Date: Thu, 26 Oct 2023 20:39:04 +0200 Subject: [PATCH] vault backup: 2023-10-26 20:39:04 --- Code CAML.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Code CAML.md b/Code CAML.md index c11f4f3..a7fbce5 100644 --- a/Code CAML.md +++ b/Code CAML.md @@ -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;;