🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #1841

Re: Review of "The Craft of Prolog"

#1841
From: Lars-Henrik Eriksson
Date: Tue, 05 Feb 1991 13:53
28 lines
1553 bytes
In article <5771@swi.swi.psy.uva.nl>, anjo@swi (Anjo Anjewierden) writes:
>
>/* 1 */	max(X, Y, X) :- X >= Y.
>	max(X, Y, Y) :- X < Y.
>
>/* 2 */	max(X, Y, X) :- X >= Y, !.
>	max(X, Y, Y) :- X < Y.
>
>/* 3 */	max(X, Y, X) :- X >= Y, !.
>	max(X, Y, Y).
>
>/* 4 */	max(X, Y, Z) :- X >= Y, !, Z = X.
>	max(X, Y, Y).
>
>If your preference is with the first program (called the pure version
>because it is a straightforward implementation of the problem
>specification) there is no need to read the book.  I would be very
>surprised if anyone selected number two.

Actually, I often use version number two. Why? I really prefer the
pure version, but inserting as cut rids me of a useless choice point.
At the same time the cut is semantically redundant (I believe O'Keefe
calls this a "green" cut).
-- 
Lars-Henrik Eriksson				Internet: lhe@sics.se
Swedish Institute of Computer Science		Phone (intn'l): +46 8 752 15 09
Box 1263					Telefon (nat'l): 08 - 752 15 09
S-164 28  KISTA, SWEDEN
Technical Details
Message-ID: <1991Feb5.135357.5213@sics.se>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!sics.se!lhe
References: <5771@swi.swi.psy.uva.nl>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!sics.se!lhe
From: lhe@sics.se (Lars-Henrik Eriksson)
Newsgroups: comp.lang.prolog
Subject: Re: Review of "The Craft of Prolog"
Message-ID: <1991Feb5.135357.5213@sics.se>
Date: 5 Feb 91 13:53:57 GMT
References: <5771@swi.swi.psy.uva.nl>
Sender: lhe@sics.se (Lars-Henrik Eriksson)
Reply-To: lhe@sics.se (Lars-Henrik Eriksson)
Organization: SICS, Kista (Stockholm), Sweden
Lines: 28
In-Reply-To: anjo@swi.psy.uva.nl (Anjo Anjewierden)