I have a database i want to write a query to return the total members in the database

member(paul,100). member(john,101). member(ryan,102). member(jabouki,103). 

Should Return 4

I also have a list and i want to return the number of persons in the list

memberlist([ant,cat,sat,bat]).

Should Return 4

Query I have thus far that only return the items in the database and list.

member(MemberName,_).
memberlist(Y)

Recommended Answers

All 4 Replies

No Help?

Sorry, but I haven't done any Prolog for almost 30 years... I'll have to refer to my copy of Clocksin and Mellish when I get home tonight.

Ok. Just reviewed the member() and memberlist() entities in C&M - please post your code here. Your examples are not really helpful.

Memberlist looks simply the length of list which is trivial.
First case could use that with findall.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.