Possible bug within GNU Prolog ?

"Vic Bancroft" <[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Message-ID <[email protected]>
The second clause in the predicate occured_once/2 relies on the behavior of
member/2 in that if the list contains an unbound variable, it counts as an
occurrance, e.g.,

  | ?- member( 1, [2,X]).

  X = 1 ?

  yes

If an unbound variable is an element of the list, then the variable can
unify with operand one and occurs, e.g.,

  | ?- occured_once(1, [V]).

  V = 1 ?

  yes


If more than one unbound variable is an element of the list, then the
occured_once predicate will always fail, e.g.,

  | ?- occured_once(1, [V,W]).

  no

The example is even more interesting when using structures,

  | ?- occured_once( v(c(1)), [ v(2), v(c(X)) ]).

  X = 1 ?

  yes


more,
l8r,
v

_______________________________________________
Users-prolog mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/users-prolog
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.