| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Counting propositions
A related Prolog question.
Guess and then check what is the meaning of "s(X)" from the following
Prolog clauses.
p(1). p(2). p(3).
s(X):-r(X,[]).
r(R,L):-q(X,L),r(R,[X|L]).
r(L,L).
q(X,L):-p(X), not(member(X,L)).
member(X,[X|_]).
member(X,[_|L]):-member(X,L).
It is possible to write a "pure" Prolog predicate that return the number of
elements that make p(X) true ?
(without using findall, bagof, setof, assert, etc.)
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
![]() |
![]() |