🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #4315

Help solving a prolog problem

#4315
From: Shashank
Date: Sun, 08 Aug 1999 00:00
15 lines
1120 bytes
 Use the process of resolution and unification to derive F <- T from

quantity( _ ,[],0) <- T.
quantity(X,[X|Y],Z) <- quantity(X,Y,Z1), Z is Z1+1.
quantity(X,[Y|Z],T) <- not X == Y, quantity(X,Z,T).
F <- quantity(3, [1,2,3,3], 2).

Briefly explain each step (one or two lines of explanation for each step is
sufficient). Give new names to
variables such as Z and Z1, when they have to be reference more that once on
the same line, e.g. Za,
Zb, ..., Z1a, Z1b, ...

Thanks.
sowmya.
Technical Details
Message-ID: <7ol26f$m15$1@news.chorus.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f8272,bb27e8e6f351d574,start
X-Google-Attributes: gidf8272,public
X-Google-Thread: 1217ff,bb27e8e6f351d574,start
X-Google-Attributes: gid1217ff,public
X-Google-Thread: f907c,bb27e8e6f351d574,start
X-Google-Attributes: gidf907c,public
From: "Shashank" <sowshank@itis.com>
Subject: Help solving a prolog problem
Date: 1999/08/08
Message-ID: <7ol26f$m15$1@news.chorus.net>
X-Deja-AN: 510394647
Organization: IntraNet Inc: Madison, Wisconsin's ISP
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Newsgroups: comp.lang.prolog,ed.prolog,fj.lang.prolog