let find_reverse ?from ?length s ~f =
let length_of_s = List.length s in
let from =
match from with
| None -> None
| Some s when s < 0 -> Some length_of_s
| Some s when s > length_of_s - 1 -> Some 0
| Some s -> Some (length_of_s - 1 - s)
in
match find ?from ?length (List.rev s) ~f with
| None -> None
| Some i -> Some (length_of_s - 1 - i)