From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL,HTML_MESSAGE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id D2770BC0B for ; Mon, 15 Jan 2007 22:52:06 +0100 (CET) Received: from NS1.home (74.220-119-85.cust.rackboost.net [85.119.220.74]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l0FLq6XE007924 for ; Mon, 15 Jan 2007 22:52:06 +0100 Received: from lloyd ([87.235.198.48]) by home with MailEnable ESMTP; Mon, 15 Jan 2007 22:51:57 +0100 Message-ID: <015f01c738ef$66bc63b0$6401a8c0@lloyd> From: "Lloyd Moore" To: Subject: The kth element Date: Mon, 15 Jan 2007 22:52:06 +0100 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_015C_01C738F7.C823B790" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.3790.2826 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2826 X-j-chkmail-Score: MSGID : 45ABF786.000 on discorde : j-chkmail score : XX : 5/20 0 0.000 -> 2 X-Miltered: at discorde with ID 45ABF786.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; sml:01 sml:01 W8:98 rec:01 rec:01 match:02 match:02 W4:96 arial:96 arial:96 element:03 let:03 let:03 correctly:05 correctly:05 This is a multi-part message in MIME format. ------=_NextPart_000_015C_01C738F7.C823B790 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable If I understood the question correctly posed by Dr Jon Harrop... let smallest lst =3D let rec sml lst v =3D 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) ;; ------=_NextPart_000_015C_01C738F7.C823B790 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
If I understood the question correctly = posed by Dr=20 Jon Harrop...
 
 let smallest lst =3D let rec sml = lst v=20 =3D
 match lst with
   [] -> = v
 | h::t=20 ->
     match t=20 with
         h::t -> if h = <=20 (List.hd t) then sml t h else sml t v
     | = _ ->=20 v
  in sml lst (List.hd lst) ;;
------=_NextPart_000_015C_01C738F7.C823B790--