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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Andrej Bauer <Andrej.Bauer@f...>
Subject: Re: [Caml-list] Amb
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