Article View: comp.lang.prolog
Article #3663Re: !/metacall/metainterpreter
From: Bruno Poterie
Date: Thu, 15 Sep 1988 14:50
Date: Thu, 15 Sep 1988 14:50
56 lines
2808 bytes
2808 bytes
In article <1435@kulcs.kulcs.uucp> bimbart@kulcs.UUCP (Bart Demoen) writes:
>This is a reply to article <358@quintus.UUCP> (R. O'Keefe)
>whose author does not understand why the mentioned metainterpreter does not
>work for programs containing metacall if ! does cut outside the scope of call/1;
>so, I will show it:
[...deleted...]
>only if !/0 does NOT cut outside call/1
First point: i consider that the war O'Keefe/Demoen --> Quintus/BIM is going
somehow outside of control, and that the metainterpret looks more
like an innocent hostage, or like a pretext, or both. So why do you
not choose a place and a time (say, Hyde Park, 1st November, 5 am),
pick up 4 of us as witness, and try to solve it with some sword?
I think it is time to stop and cool the thing down, or the net will
burn soon :-)
Second point: now i am probably so stupid, but i was taught the following
model for prolog procedures, predefined or not:
Head<1> :- Goal<1,1>, ...Goal<1,i>, ... Goal<1,n>.
...
Head<j> :- Goal<j,1>, ...Goal<j,i>, ... Goal<j,n>.
...
Head<m> :- Goal<m,1>, ...Goal<m,i>, ... Goal<m,n>.
where a cut appearing in the list of goals being the body of the
clause <j> had as effect to remove all choices created since
passing the neck of this clause, and including the neck itself,
i.e. forgetting the remaining clauses [j+1 .. m].
and that BIPs had the following form:
BipHead :-
{ and-written body }
then the call/1 predicate is defined as:
call(X) :-
X.
where X is dynamically replaced by its value. Now considering both
sub-models, if the value of the variable X is the term ! <atom>,
then the effect of call(!) is to remove all choices between the
neck of call/1 and the substitution of X by !, including remaining
clauses for call/1. But the cut will -and can- NEVER affect choices
which are olders than the passing of the neck of call/1. If you
want this can of thing, then you have to use a labelled cut, in
fact a set of BIPs which as a side-effect update the choice-points
stack (or whatever you use as a backtrack control structure).
But then this is completely different from a cut, which is integrated
into the virtual machine (as well as the if-then-else (A->B;C)).
Therefore building your critic on the final remark that
>only if !/0 does NOT cut outside call/1
is almost surrealistic ;-)
Technical Details
Message-ID:
<623@ecrcvax.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!unido!ecrcvax!brunoReferences:
<1435@kulcs.kulcs.uucp>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!unido!ecrcvax!bruno From: bruno@ecrcvax.UUCP (Bruno Poterie) Newsgroups: comp.lang.prolog Subject: Re: !/metacall/metainterpreter Summary: Cool and the Gang Message-ID: <623@ecrcvax.UUCP> Date: 15 Sep 88 14:50:52 GMT References: <1435@kulcs.kulcs.uucp> Reply-To: bruno@ecrcvax.UUCP (Bruno Poterie) Organization: ECRC, Munich 81, West Germany Lines: 56