🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #2700

Counting things.

#2700
From: Doug Collinge
Date: Thu, 02 Jul 1987 04:35
20 lines
1355 bytes
OK, I looked in Clocksin and Mellish and couldn't find it.  Now I ask you
at the risk of looking foolish...

Say you have a bunch of relations in the database, r(X).  How do you count
up the number of them?  I have been using "setof(X,r(X),LX)" and then 
measuring the length of LX with something else.  This seems crude and brutal
to me - how can I do it directly?

Of course, it is really more complicated than this but this is the kernal of
the problem.

In a related development, can "setof" be  implemented in Prolog? How?
-- 
		Doug Collinge
		School of Music, University of Victoria,
		PO Box 1700, Victoria, B.C.,
		Canada,  V8W 2Y2  
		collinge@uvunix.BITNET
		decvax!uw-beaver!uvicctr!collinge
		ubc-vision!uvicctr!collinge
Technical Details
Message-ID: <263@uvicctr.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!mit-eddie!uw-beaver!ssc-vax!uvicctr!collinge
References: <8706240740.AA23829@ucbvax.Berkeley.EDU>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!mit-eddie!uw-beaver!ssc-vax!uvicctr!collinge
From: collinge@uvicctr.UUCP (Doug Collinge)
Newsgroups: comp.lang.prolog
Subject: Counting things.
Message-ID: <263@uvicctr.UUCP>
Date: Thu, 2-Jul-87 00:35:10 EDT
Article-I.D.: uvicctr.263
Posted: Thu Jul  2 00:35:10 1987
Date-Received: Sat, 4-Jul-87 13:10:15 EDT
References: <8706240740.AA23829@ucbvax.Berkeley.EDU>
Reply-To: collinge@uvicctr.UUCP (Doug Collinge)
Distribution: na
Organization: University of Victoria, Victoria B.C. Canada
Lines: 20