Article View: comp.lang.prolog
Article #1402Re: Quintus Prolog Problem
From: Ken Johnson
Date: Wed, 14 Nov 1990 12:33
Date: Wed, 14 Nov 1990 12:33
36 lines
1836 bytes
1836 bytes
In article <264@messina.cs.utexas.edu> bradley@cs.utexas.edu (Bradley L. Richards) writes:
# As near as I can tell, setof and bagof don't work properly with the
# "recorded" predicate in Quintus Prolog (version 2.5.1, sun3-4.0).
#
# If I record: recorda(woof, term2, _),
# recorda(woof, term1, _).
#
# and then query: setof(X, recorded(woof, X, _), Set).
#
# I receive the answer Set = [term2], and on backtracking the answer
# Set - [term1]. It seems to me that I should receive a single answer
# Set - [term1, term2].
#
# Am I missing something? Or is this a known bug?
#
# Bradley
You're missing something. That's the correct behaviour. Look again at
the incantation:
?- setof(X, recorded(woof, X, _), Set).
That anonymous variable will be given a different value on each
backtrack. To state that you want all values to be included in Set, use
the existential quantifier and give the variable a name:
?- setof(X, Ref^recorded(woof, X, Ref), Set).
In general you should not use the anonymous variable anywhere inside a
setof or bagof unless you *know* what you are doing.
--
Ken Johnson, AI Applications Inst., 80 South Bridge, Edinburgh EH1 1HN
E-mail ken@aiai.ed.ac.uk, ******************************************
phone 031-225 4464 extension 213 ** `You can resole your boot, but you **
new quotation --> ** can't reboot your soul' [The Oracle] **
Technical Details
Message-ID:
<3751@skye.ed.ac.uk>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!edcastle!aiai!kenReferences:
<264@messina.cs.utexas.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!edcastle!aiai!ken From: ken@aiai.ed.ac.uk (Ken Johnson) Newsgroups: comp.lang.prolog Subject: Re: Quintus Prolog Problem Message-ID: <3751@skye.ed.ac.uk> Date: 14 Nov 90 12:33:37 GMT References: <264@messina.cs.utexas.edu> Reply-To: ken@aiai.UUCP (Ken Johnson) Organization: Bugs-R-Us Lines: 36