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 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 EFC6FBC69 for ; Fri, 9 Feb 2007 23:12:20 +0100 (CET) Received: from postar.fmf.uni-lj.si (vega.fmf.uni-lj.si [193.2.67.45]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l19MCK5d027903 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 9 Feb 2007 23:12:20 +0100 Received: from localhost (unknown [192.168.5.1]) by postar.fmf.uni-lj.si (Postfix) with ESMTP id D9CF110BA2D; Fri, 9 Feb 2007 23:12:19 +0100 (CET) X-Virus-Scanned: amavisd-new at spam.fmf.uni-lj.si Received: from postar.fmf.uni-lj.si ([192.168.5.5]) by localhost (spam.fmf.uni-lj.si [192.168.5.1]) (amavisd-new, port 10024) with ESMTP id jDdOr9YmOiaN; Fri, 9 Feb 2007 23:25:36 +0100 (CET) Received: from [192.168.1.100] (BSN-77-186-71.dsl.siol.net [193.77.186.71]) by postar.fmf.uni-lj.si (Postfix) with ESMTP id 042FB10BA2B; Fri, 9 Feb 2007 23:12:18 +0100 (CET) Message-ID: <45CCF1D6.5040302@fmf.uni-lj.si> Date: Fri, 09 Feb 2007 23:12:38 +0100 From: Andrej Bauer Reply-To: Andrej.Bauer@andrej.com User-Agent: Icedove 1.5.0.9 (X11/20061220) MIME-Version: 1.0 To: Brian Hurt Cc: Jonathan Bryant , caml-list@yquem.inria.fr Subject: Re: [Caml-list] Amb References: <1197BD5D-1373-4876-8DC1-FED84797E4A6@valdosta.edu> <45CCEDCC.1090200@janestcapital.com> In-Reply-To: <45CCEDCC.1090200@janestcapital.com> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 45CCF1C4.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; andrej:01 andrej:01 ocaml:01 denotes:01 chosing:01 amb:98 amb:98 angelic:98 exception:01 caml-list:01 computation:01 element:03 let:03 raise:03 conditional:04 To make this thread worthy of a non-beginner ocaml list, let me point out that amb is supposed to work as an _angelic_ nondeterministic choice operator. This means it must choose a value that, if at all possible, leads to successful completion of the computation. In particular, the piece of code (assuming exception Amb denotes failure) if (abm [(fun _ -> false); (fun _ -> true)]) then 7 else (raise Amb) should return 7, i.e., the amb inside the conditional should "know" (be told by an angel) that the right choice is the second element of the list because it leads to 7, whereas chosing the first one leads to failure. I am afraid the implementation given by Jonathan does not satisfy this condition. And I don't see how to make it work. The scheme implementation involves callcc magic. If anyone knows a reasonable implementation of amb, I'd be interested to know. Andrej