[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] Using the amb egg
From: |
Jeronimo Pellegrini |
Subject: |
[Chicken-users] Using the amb egg |
Date: |
Mon, 9 Aug 2010 21:08:05 -0300 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Hi,
I've installed the amb egg and could use it, but I'm a bit confused:
#;1> (use amb amb-extras)
...
#;2> (let ((a (amb 1 2 3)) (b (amb -1 -2 -3))) (required (= (+ a b) 0))
(list a b))
(1 -1)
#;3> (let ((a (amb 1 2 3)) (b (amb -1 -2 -3))) (required (= (+ a b) 10))
(list a b))
(2 -2)
So, out of the scope of the first LET I use amb and require again, and
it returned values that would work for the first time (but not the
second).
If I leave the interpreter and try the impossible one from the start,
it does the right thing and signals an error:
#;2> (let ((a (amb 1 2 3)) (b (amb -1 -2 -3))) (required (= (+ a b) 10))
(list a b))
Error: (amb) expression tree exhausted
Call history:
...
What's the semantics of amb and require in this situation? Am I supposed
to do something between the two lets? (Does amb need a "restart" or
something?)
I'm using git master (4f3e7c7ca683d7c8fc208f9632c77cc08f2eee9b) and
amb 2.1.2.
Thanks,
J.
- [Chicken-users] Using the amb egg,
Jeronimo Pellegrini <=