Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-02-09 (22:12)
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
     (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.