Article View: comp.lang.prolog
Article #3078Re: Triangle Puzzle (Trilogy)
From: J Andrews
Date: Thu, 10 Mar 1988 13:35
Date: Thu, 10 Mar 1988 13:35
31 lines
1851 bytes
1851 bytes
In article <508@ecrcvax.UUCP> micha@ecrcvax.UUCP (Micha Meier) writes:
>> x := 6 & Incr(x) & y = x & Incr(x) & P(x)
let's call this A
>
>This is an abbreviation for
>
> x1 = 6 & Incr(x1, x2) & y = x2 & Incr(x2, x3) & P(x3)
let's call this B
I should just emphasise that what Micha means here by
"B is an abbreviation for A" is that the "meaning" of A, when
translated into standard logic-programming form, is B. In the
implementation of Trilogy, however, the assignment is indeed
done destructively, without new variables being created.
Some work has been done on detecting cases in Prolog in
which space for variables can be reused. However, I think such
algorithms have to effectively put the program in disjunctive
normal form, and so are unlikely to be very efficient. I think
the Trilogy approach of letting the programmer declare and
reassign input/output variables is cleaner. (However, I am not
really an impartial observer. :-))
This way of explaining assignment in logic programming
languages actually suggests a way of explaining it in imperative
languages. Watch out -- we may soon see logic programming being
used as the semantic basis for conventional languages!
--Jamie.
jha@lfcs.ed.ac.uk
"I am thinking of aurochs and angels, of the secrets of durable pigments"
Technical Details
Message-ID:
<1063@its63b.ed.ac.uk>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!mcvax!ukc!its63b!jhaReferences:
<652@cresswell.quintus.UUCP> <1863@ubc-cs.UUCP> <721@cresswell.quintus.UUCP> <508@ecrcvax.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!mcvax!ukc!its63b!jha From: jha@its63b.ed.ac.uk (J Andrews) Newsgroups: comp.lang.prolog Subject: Re: Triangle Puzzle (Trilogy) Message-ID: <1063@its63b.ed.ac.uk> Date: 10 Mar 88 13:35:33 GMT References: <652@cresswell.quintus.UUCP> <1863@ubc-cs.UUCP> <721@cresswell.quintus.UUCP> <508@ecrcvax.UUCP> Reply-To: jha@lfcs.ed.ac.uk (J Andrews) Organization: Dept. of Computer Science, Univ. of Edinburgh, U.K. Lines: 31 Keywords: Modifiable Variables, State Transition, TRILOGY.