🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #3398

Re: Clause fusion (Disjunctions)

#3398
From: mccaugh
Date: Sat, 28 May 1988 06:14
64 lines
2522 bytes
/* Written  1:14 am  May 28, 1988 by mccaugh@uiucdcsm.cs.uiuc.edu in uiucdcsm:comp.lang.prolog */
/* Written  3:43 am  May 25, 1988 by micha@ecrcvax.UUCP in uiucdcsm:comp.lang.prolog */
/* ---------- "Re: Clause fusion (Disjunctions)" ---------- */
In article <1001@cresswell.quintus.UUCP> ok@quintus.UUCP (Richard A. O'Keefe) writes:
>In article <539@ecrcvax.UUCP>, micha@ecrcvax.UUCP (Micha Meier) writes:
>> Richard proposes that nested if-then-else's are treated at the same level,
>> which leads to confusions since then the indentation is context dependent
>> (an if-then-else inside another one cannot be indented independently).
>
>I DO NOT!  I use exactly the same rule for indenting if->then;elses in
>Prolog that I use in Fortran 77, Pop, ADA, Algol 68, et cetera.  Namely
>
>	<IF> <condition> <THEN>
>	[1 indent] <body>
>	<ELIF> <condition> <THEN>
>	[1 indent] <body>
>	...
>	<ELSE>
>	[1 indent] <body>
>	<ENDIF>
>
	The problem with Prolog is that any of the term can be
	a conjunction, disjunction or if-then-else. What about

	(	(	C1 ->
			B1
		;
			B2
		) ->
		(	C2 ->
			B3
		;
			B4
		),
		B5
	;	B6,
		B7
	)

	I find it not much readable when the condition is difficult
	to distinguish from the other code.

>	( test1 ->
>	    body1
>	; test2 ->
>	    body2
>	; /*otherwise*/
>	    body3
>	)

	Here it is different - how exactly do you indent your procedures?
	This problem might seem to be a minor one, but should not there
	be at least a recommendation from the standard or from somebody
	else? Prolog does not have many syntactical structures and therefore
	it is extremely important to keep some programming style, e.g.
	to use names_like_that for procedures and LikeThat for variables,
	to put each goal on a separate line etc. I've been trying to
	port various external programs to Sepia and sometimes it's rather
	difficult to realize what the author really meant.

--Micha
/* End of text from uiucdcsm:comp.lang.prolog */
/* End of text from uiucdcsm:comp.lang.prolog */
Technical Details
Message-ID: <5500002@uiucdcsm>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!rutgers!iuvax!pur-ee!uiucdcs!uiucdcsm!mccaugh
References: <548@ecrcvax.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!rutgers!iuvax!pur-ee!uiucdcs!uiucdcsm!mccaugh
From: mccaugh@uiucdcsm.cs.uiuc.edu
Newsgroups: comp.lang.prolog
Subject: Re: Clause fusion (Disjunctions)
Message-ID: <5500002@uiucdcsm>
Date: 28 May 88 06:14:00 GMT
References: <548@ecrcvax.UUCP>
Lines: 64
Nf-ID: #R:ecrcvax.UUCP:548:uiucdcsm:5500002:000:1996
Nf-From: uiucdcsm.cs.uiuc.edu!mccaugh    May 28 01:14:00 1988