[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Possible bug within GNU Prolog ?
From: |
Ahmed S. Darwish |
Subject: |
Possible bug within GNU Prolog ? |
Date: |
Sat, 5 May 2007 01:54:12 +0300 |
User-agent: |
Mutt/1.5.11 |
Hi all,
While Doing a Prolog college assignment, I faced the following strange problem:
occured_once(X, List) is true iff X occured once in List:
occured_once(X, [X]).
occured_once(H, [H | T]) :-
\+ member(H, T).
occured_once(X, [H | T]) :-
\+ X = H,
occured_once(X, T).
Compiling and executing above snipped, here's some queries:
| ?- occured_once(1, [1, 2, X]).
no
| ?- occured_once(1, [1, 2, 3]).
true ?
yes
So How come first test says that no X satisfy the first query, while it says
that the second query is true (same query substiuting X with 3) ?.
$ gprolog --version
Prolog top-Level (GNU Prolog) 1.2.18
Thanks,
--
Ahmed S. Darwish
http://darwish.07.googlepages.com
- Possible bug within GNU Prolog ?,
Ahmed S. Darwish <=