let find_max (cmp: '-> '-> int) (list: 'a list) : 'a =
  match list with
    | [] ->
        raise Not_found

    | head :: tail ->
        List.fold_left
          (fun max next ->
             if cmp max next >= 0 then
               max
             else
               next
          )
          head
          tail