Version française
Home     About     Download     Resources     Contact us    
Browse thread
The kth element
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Lloyd Moore <lloyd@e...>
Subject: The kth element
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) ;;