🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.prolog
Article #607

Re: Standard behavior?

#607
From: Tom Frauenhofer
Date: Wed, 14 May 1986 12:47
51 lines
2114 bytes
>>In article <7233@duke.UUCP> cds@duke.UUCP (Craig D. Singer) writes:
>>In article <6500005@uicsl> gooley@uicsl.UUCP writes:
>>>
>>>Consider the following trivial predicate:
>>>
>>>a([]).
>>>a(_).
>>>
>>>Given the query :-a([]). , C-Prolog finds one match and UNSW Prolog finds two.
>>>Which is standard behavior?  How do other implementations behave?
>>
>>I do not have the authority to say which is "standard" behavior, if by that
>>you mean which is found more commonly in implementations.  However, any book
>>on "vanilla" Prolog will tell you that "_" matches to anything, including a
>>null list, so I would indeed be annoyed by C-Prolog if it did not find two
>>matches.  Anybody disagree?

>Well, after I posted the above response I went ahead and checked out the
>version of C-Prolog which comes with 4.2/4.3 BSD and it DOES find two
>matches.  The way to note this is to expand the predicate as follows:

>a([],2).
>a(_,3).

>Then ask the query a([],X).  The response will be:

>X = 2

>after which you can type a semicolon and hit return, which produces:

>X = 3

>So C-Prolog (and, I would guess, any prolog) finds both matches.

For whoever is collecting /interested in this information:

I tried both of the above scenarios in Turbo Prolog and the PD version of
A.D.A Prolog.  The results:

Turbo Prolog:
	First scenario: 1 match
	Second scenario: 2 matches

A.D.A PDProlog:
	First scenario: 2 matches
	Second scenario: 2 matches

-- Tom Frauenhofer

...!seismo!rochester!ur-tut!tfra
Technical Details
Message-ID: <346@ur-tut.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!linus!philabs!cmcl2!seismo!rochester!ur-tut!tfra
References: <6500005@uicsl> <7233@duke.UUCP> <7234@duke.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!linus!philabs!cmcl2!seismo!rochester!ur-tut!tfra
From: tfra@ur-tut.UUCP (Tom Frauenhofer)
Newsgroups: net.lang.prolog
Subject: Re: Standard behavior?
Message-ID: <346@ur-tut.UUCP>
Date: Wed, 14-May-86 08:47:18 EDT
Article-I.D.: ur-tut.346
Posted: Wed May 14 08:47:18 1986
Date-Received: Fri, 16-May-86 05:32:28 EDT
References: <6500005@uicsl> <7233@duke.UUCP> <7234@duke.UUCP>
Reply-To: tfra@ur-tut.UUCP (Tom Frauenhofer)
Organization: Univ. of Rochester Computing Center
Lines: 51