Opened 12 years ago

Closed 12 years ago

#303 closed defect (fixed)

amb does not fail when there's no acceptable values

Reported by: Jeronimo Pellegrini Owned by:
Priority: minor Milestone:
Component: extensions Version:
Keywords: amb egg Cc:
Estimated difficulty:

Description

Hi,

It seems that amb will not fail at all when there are no acceptable values:

(let ((a (amb 1 2 3))
      (b (amb -1 -2 -3)))
  (required (> (+ a b) 10))
  (print (list a b)))

==> (3 -1)

As I understand, it should have failed just like (amb) without arguments would...

This is version 2.1.2 of amb with Chicken 4.5.7 (experimental).

J.

Change History (3)

comment:1 Changed 12 years ago by Kon Lovett

Resolution: worksforme
Status: newclosed

csi -n

CHICKEN
(c)2008-2010 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 4.5.6
macosx-unix-gnu-ppc [ symbolgc manyargs dload ptables gchooks ]
compiled 2010-07-10 on Nikko-2.local (Darwin)
#;1> (use amb amb-extras)

#;2> (let ((a (amb 1 2 3))

(b (amb -1 -2 -3)))

(required (> (+ a b) 10))
(print (list a b)))

Error: (amb) expression tree exhausted

Call history:

<eval> (> (+ a b) 10)
<eval> (+ a b)
<eval> ((amb#amb-failure-continuation))
<eval> (amb#amb-failure-continuation)
<eval> (> (+ a b) 10)
<eval> (+ a b)
<eval> ((amb#amb-failure-continuation))
<eval> (amb#amb-failure-continuation) <--

comment:2 Changed 12 years ago by Jeronimo Pellegrini

Resolution: worksforme
Status: closedreopened
Version: 4.6.0

Hi,

It seems that the bug is now reproducible with the master branch of Chicken also:

$ csi

CHICKEN
(c)2008-2010 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 4.6.0rc1 
linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
compiled 2010-08-09 on newton (Linux)

#;1> (use amb amb-extras)
...
#;2> (let ((a (amb 1 2 3)) (b (amb -3 -2 -1))) (required (= (+ a b) 0)) (list a b))
(1 -1)
#;3> (let ((a (amb 1 2 3)) (b (amb -3 -2 -1))) (required (= (+ a b) 10)) (list a b))
(2 -2)
#;4> (let ((a (amb 1 2 3)) (b (amb -3 -2 -1))) (required (= (+ a b) 0)) (list a b))
(1 -1)
#;5> (let ((a (amb 1 2 3)) (b (amb -3 -2 -1))) (required (= (+ a b) 0)) (required (even? a)) (list a b))
(2 -2)
#;6> (let ((a (amb 1 2 3)) (b (amb -3 -2 -1))) (required (= (+ a b) 50)) (required (even? a)) (list a b))
(2 -2)

This is fc8d57e897df9eefd638b9358250fbd3069c70f9 from git master; I have reinstalled amb before running these tests.

comment:3 Changed 12 years ago by Jeronimo Pellegrini

Resolution: fixed
Status: reopenedclosed

... and a couple of hours later, with aa5874e1fc35c8d343771ce9dd954b87dc3551a0, the bug is gone. Sorry for the noise!

Note: See TracTickets for help on using tickets.