If I understood the question correctly posed by Dr Jon Harrop... let smallest lst = let rec sml lst v = match lst with [] -> v | h::t -> match t with h::t -> if h < (List.hd t) then sml t h else sml t v | _ -> v in sml lst (List.hd lst) ;;