Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!mcsun!unido!tub!fauern!lan!grosse From: grosse@lan.informatik.tu-muenchen.dbp.de (Malte Grosse) Newsgroups: comp.lang.prolog Subject: bagof & setof Summary: existential quantifiers Message-ID: <2177@infovax.lan.informatik.tu-muenchen.dbp.de> Date: 21 Nov 89 11:17:41 GMT Reply-To: grosse@lan.informatik.tu-muenchen.dbp.de (Malte Grosse) Organization: Inst. fuer Informatik, TU Muenchen, W. Germany Lines: 64 A few weeks ago there was a request for bagof & setof, since it is not build-in in every PROLOG. With the help of previous announcements I was able to implement bagof and setof. But I have still some trouble to find out the "free_variables" (these are those which are neither in the template nor in a existential quantifier). I have the following questions: - is bagof(X, (Y^fact1(X,Y),Z^fact2(X,Z)), L) equal to bagof(X, Y^Z^(fact1(X,Y),fact2(X,Z)), L) (I assume it) - is bagof(X, (Y^fact1(X,Y,Z),Z^fact2(X,Z)), L) equal to bagof(X, Y^Z^(fact1(X,Y,Z),fact2(X,Z)), L) (I assume it aswell) - is bagof(X,Y^(fact(X,Y),!),L) the same as bagof(X,(fact(X,Y),!),L) the same as fact(X,_),L=[X],! (quite useless I know) - where does bagof(X, (Y^fact1(X,Y,Z);Z^fact2(X,Z)), L) yield to? to bagof(X, Y^Z^(fact1(X,Y,Z);fact2(X,Z)), L) or to bagof(X, Y^Znew^(fact1(X,Y,Z);fact2(X,Znew)), L) (Does anyone know how to handle this?) or does it give ALWAYS only one instance (the first), since the 'fail' to get the solution is a level higher than the two facts, because of the 'or'. I really interested in receiving the opinions from other PROLOG programmers. Or if possible references to literature. Malte please reply to: grosse%lan.informatik.tu-muenchen.dbp.de@relay.cs.net --------------------------------------------------------------------------- TTTTTTT U U M M TECHNICAL UNIVERSITY OF MUNICH T U U MM MM INSTITUT FUER INFORMATIK T U U M M M M ORLEANSSTRASSE 34 T U U M M M M D-8000 MUENCHEN 80 T U U M M M T UUUUUU M M WEST-GERMANY