Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!delmarva.com!news-out.internetmci.com!internetMCI!newsfeed.internetmci.com!in2.uu.net!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
From: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
Subject: Re: Can you do this?
Message-ID: <9530014.5780@mulga.cs.mu.OZ.AU>
Sender: news@cs.mu.OZ.AU (CS-Usenet)
Organization: Computer Science, University of Melbourne, Australia
References: <1995Oct17.191133.1@vax.sbu.ac.uk> <1995Oct20.121127.1@vax.sbu.ac.uk> <30878F46.1306@vms.uci.kun.nl>
Date: Fri, 27 Oct 1995 04:57:12 GMT
Lines: 35

"Henk P. Schotel" <HSCHOTEL@vms.uci.kun.nl> writes:

>/* OK then, yet another hint: */
>
>remove_parentheses(T1*(T2*T3),T):- !,
> remove_parentheses(T1*T2*T3,T).
>remove_parentheses(T1*T2,NT1*NT2):- !,
> remove_parentheses(T1,NT1),
> remove_parentheses(T2,NT2).
>
>remove_parentheses(T1+(T2+T3),T):- !,
> remove_parentheses(T1+T2+T3,T).
>remove_parentheses(T1+T2,NT1+NT2):- !,
> remove_parentheses(T1,NT1),
> remove_parentheses(T2,NT2).
>
>remove_parentheses(T,T).

Why do people persist in writing non-steadfast code using cut?

Consider the goal

	?- remove_parentheses((1+(2+3))+4,(1+(2+3))+4).

Should this succeed?  With the definition of remove_parenthese above, does it?

Anyone who thinks code like the above is good code should read
Richard O'Keefe's book "The Craft of Prolog".

Can anyone think of a language construct in any language that is more
widely misused than Prolog's cut?

--
Fergus Henderson             	WWW: http://www.cs.mu.oz.au/~fjh
fjh@cs.mu.oz.au              	PGP: finger fjh@128.250.37.3
