Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mcvax!ukc!icdoc!cdsm From: cdsm@doc.ic.ac.uk (Chris Moss) Newsgroups: net.lang.prolog Subject: Re: Dave Plummer's bagof query Message-ID: <358@ivax.doc.ic.ac.uk> Date: Fri, 22-Aug-86 05:53:11 EDT Article-I.D.: ivax.358 Posted: Fri Aug 22 05:53:11 1986 Date-Received: Wed, 27-Aug-86 10:15:41 EDT Sender: cdsm@doc.ic.ac.uk Reply-To: cdsm@doc.ic.ac.uk (Chris Moss) Organization: Dept. of Computing, Imperial College, London, UK. Lines: 33 >>Date: Wed 6 Aug 86 14:38:43-CDT >>From: Dave Plummer >>Subject: DEC-10 Bagof - Bug? >> >>Given the program: >> >>p(1,_). p(2,_). p(3,3). p(4,4). >> >>and the goal bagof(X, p(X,Y), S). Edinburgh DEC-10 Prolog >>returns, >> >>S = [1,2,3] X = _ Y = 3 >>S = [4] X = _ Y = 4 >> >>This behaviour doesn't agree with my reading of the >>documentation Poplog produces the solutions: S=[4] X =_1 Y=4 S=[3] X =_1 Y=3 S=[1,2] X=_1 Y=_2 which is _slightly_ more consistent. The problem has been dealt with in: Lee Naish: All solutions predicates in Prolog. Tech Report 84/4, Dept of Comp. Sc., Univ of Melbourne. (it's been published I think, but I forget where) He has a 'hard-line' solution which involves coroutining and never returning variables if they can be subsequently bound. Chris Moss. cdsm@doc.ic.ac.uk cdsm@icdoc.uucp