Article View: comp.lang.prolog
Article #3405Re: Clause fusion (Disjunctions)
From: Micha Meier
Date: Wed, 25 May 1988 08:43
Date: Wed, 25 May 1988 08:43
58 lines
2188 bytes
2188 bytes
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
Technical Details
Message-ID:
<548@ecrcvax.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!unido!ecrcvax!michaReferences:
<983@cresswell.quintus.UUCP> <5501@megaron.arizona.edu> <539@ecrcvax.UUCP> <1001@cresswell.quintus.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!unido!ecrcvax!micha From: micha@ecrcvax.UUCP (Micha Meier) Newsgroups: comp.lang.prolog Subject: Re: Clause fusion (Disjunctions) Message-ID: <548@ecrcvax.UUCP> Date: 25 May 88 08:43:43 GMT References: <983@cresswell.quintus.UUCP> <5501@megaron.arizona.edu> <539@ecrcvax.UUCP> <1001@cresswell.quintus.UUCP> Reply-To: micha@ecrcvax.UUCP (Micha Meier) Organization: ECRC, Munich 81, West Germany Lines: 58 Posted: Wed May 25 09:43:43 1988