From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 1BC84BDDA for ; Fri, 26 Aug 2005 22:27:23 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j7QKRMtK019935 for ; Fri, 26 Aug 2005 22:27:22 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA00148 for ; Fri, 26 Aug 2005 22:27:22 +0200 (MET DST) Received: from smtp.cegetel.net (mf01.sitadelle.com [212.94.174.68]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j7QKRLCQ019932 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Fri, 26 Aug 2005 22:27:22 +0200 Received: from [192.168.144.2] (84-4-33-159.adslgp.cegetel.net [84.4.33.159]) by smtp.cegetel.net (Postfix) with ESMTP id 2E5123182CC; Fri, 26 Aug 2005 22:27:20 +0200 (CEST) Message-ID: <430F7B27.4040208@univ-savoie.fr> Date: Fri, 26 Aug 2005 22:27:19 +0200 From: Christophe Raffalli User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: fr, en MIME-Version: 1.0 To: David Thomas , caml-list Subject: Re: [Caml-list] Puzzle References: <20050826192117.98447.qmail@web30503.mail.mud.yahoo.com> In-Reply-To: <20050826192117.98447.qmail@web30503.mail.mud.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Miltered: at concorde with ID 430F7B2A.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 430F7B29.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; christophe:01 raffalli:01 christophe:01 raffalli:01 univ-savoie:01 caml-list:01 tsort:01 tsort:01 caml-list:01 beginner's:01 ocaml:01 beginners:01 bug:01 ...:98 ...:98 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.3 David Thomas a écrit : > I have three lists that I would like to have sorted > through user interaction. I can, of course, say > "List.sort ask list" for each list. What if, however, > rather than sorting each list in turn, I wanted the > questions to be interleaved, either randomly or in a > prespecified sequence? Is it possible to do this > without reimplementing sort? I easily could, but it > seems more fun without... > This should work (I did not test ...), But the input output may not work, One should have a separate thread to interact with the user and the sorting thread sending request to this thread ... but you may assume all this is done by the ask function. let tsort l = let r = ref [] in let g l = r := List.sort ask l in let th = Thread.create g l in th, r let result = let th1, r1 = tsort l1 in let th2, r2 = tsort l2 in let th3, r3 = tsort l3 in Thread.join th1; Thread.join th2; Thread.join th3; !r1, !r2, !r3 > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs