chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] amb egg bug/confusion


From: Thomas Chust
Subject: Re: [Chicken-users] amb egg bug/confusion
Date: Thu, 15 Mar 2012 01:38:19 +0100

On Wed, 2012-03-14 at 18:23 -0600, Alan Post wrote:
> [...]
>   (pretty-print (let ((s (amb 0 1 2))) (amb-collect s)))
> [...]
> produces:
> [...]
>   (0)
> [...]

Hello,

to me this behaviour looks correct. amb-collect is supposed to collect
all the different values its argument can take on, but in your example s
is not an ambivalent expression -- the fact that s is bound to a value
produced by amb only makes the let expression ambivalent.

To phrase it more technically: Every amb-collect creates a new dynamic
scope for backtracking. Any ambivalence introduced in that dynamic scope
will be resolved and the results will be collected but any outer dynamic
scope will not be affected.

Ciao,
Thomas


-- 
When C++ is your hammer, every problem looks like your thumb.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]