🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.micro.pc
Article #7644

Turbo Prolog questions

#7644
From: Ted Holden
Date: Thu, 14 Aug 1986 02:28
37 lines
1369 bytes

        Has anyone gotten good with Turbo Prolog yet?  I kind of need
help with two of the items in the manual.  First, I was able to get
sample program 25 (the one which was screwed up from jump) to work after
a fashion via:

             /* Program 25 */
domains
    list = integer*
predicates
    member(integer,list)
    intersect(list,list,list)
clauses
    member(X,[X|_]).
    member(X,[_|Y]):- member(X,Y).

    intersect([],_,_).
    intersect([H|T],Y,[H|T2]):-
        member(H,Y),intersect(T,Y,T2).


which, given the goal "intersect(X,[1,2,3],[2,3,5,6,7])", yeilds three
solutions:

[],
[2],
[2,3]

only the last of which you want.  Any better solutions?

Secondly, does anyone understand the meaning or usage of the predicate
"moredata(file)" in the sample code on page 141?  The same thing is done
on the next page, the predicate being called "repeat" there.
Any help would be appreciated.

Ted Holden
Technical Details
Message-ID: <593@imsvax.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!elsie!imsvax!ted

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!elsie!imsvax!ted
From: ted@imsvax.UUCP (Ted Holden)
Newsgroups: net.micro.pc
Subject: Turbo Prolog questions
Message-ID: <593@imsvax.UUCP>
Date: Wed, 13-Aug-86 22:28:13 EDT
Article-I.D.: imsvax.593
Posted: Wed Aug 13 22:28:13 1986
Date-Received: Thu, 14-Aug-86 08:25:10 EDT
Organization: IMS Inc, Rockville MD
Lines: 37