[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Possible bug within GNU Prolog ?
From: |
Vic Bancroft |
Subject: |
Possible bug within GNU Prolog ? |
Date: |
Wed, 16 May 2007 21:07:16 -0400 |
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