[racket] handy trick for "amb-collect" desired

From: Deren Dohoda (deren.dohoda at gmail.com)
Date: Sun Sep 12 14:16:27 EDT 2010

You might want to consider something like the "Backtracking via the
stream of successes" mentioned in SRFI 41, unless you are very wed to
amb.

On Sun, Sep 12, 2010 at 10:16 AM, Stefan Busch <stefan_busch_ at arcor.de> wrote:
> Hello racket community,
>
> though it may be impolite to enter the community with a wish,
> I'd like to ask for help with the following problem:
>
>
> I want a and b to "run through" all elements of two given lists,
> and then to catch the combinations that fullfill a desired condition with
> an "amb-assert" statement.
>
> If I try this in the following way
>
> (amb-collect
> (let ((a (amb *someList*)
>        (b (amb *someDifferentList*))...............
>
> it turns out that not the list elemets are considered possible values for a
> or b,
> but the lists themselves are treated as the only possible value.
>
> In all examples I could find for the uage of "amb-collect" the values to run
> through were
> recited, but in my case these are quite many, so would be grateful for a
> handier solution.
>
> thanks,
> Stefan
>
>
>
>
>
>
>
>
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>


Posted on the users mailing list.