Re: strange behavior of subset
db <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
Thanks for your answer. Prolog users must be very careful with this predicate (the name "subset" is rather hazardous). here is a simpler example : ?- subset([p(A), q(A)], [p(1), p(2), q(2)]). false. ?- subset([p(A), q(A)], [p(2), p(1), q(2)]). A = 2, B = 3. Cheers Dominique Le 07/01/2014 14:52, Jan Wielemaker a écrit : > On 01/07/2014 02:21 PM, db wrote: >> Ok I found the problem : >> >> subset is based on membercheck that succeeds only once. > > Yes. It is one of these predicates that have been added to > the library very long ago. The documentation already suggests > it is not a logical predicate. You give a nice example. > > Cheers --- Jan > >> >> Bye. >> Dominique >> >> >> Le 07/01/2014 14:17, db a �crit : >>> Hello, >>> >>> I used swi prolog Multi-threaded, 64 bits, Version 7.1.4 >>> under Ubuntu. >>> >>> I am suprise by the behavior of the subset predicate : >>> >>> >>> ?- subset([p(A), q(A,B)], [p(1), p(2), q(2,3)]). >>> false. >>> >>> >>> ?- subset([p(A), q(A,B)], [p(2), p(1), q(2,3)]). >>> A = 2, >>> B = 3. >>> >>> Thus subset takes into account the order of the element >>> in the sets, what is not expected when one deals with sets. >>> Is is normal ? >>> >>> Thanks a lot >>> >>> Dominique >>> >>> >>> >>> _______________________________________________ >>> SWI-Prolog mailing list >>> [email protected] >>> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog >>> >>> >>> >> >> _______________________________________________ >> SWI-Prolog mailing list >> [email protected] >> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog > > _______________________________________________ > SWI-Prolog mailing list > [email protected] > https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog > > !DSPAM:152,52cc06e7282751714217589! > _______________________________________________ SWI-Prolog mailing list [email protected] https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog