🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #1176

Re: Arrays in Prolog

#1176
From: Micha Meier
Date: Mon, 03 Sep 1990 12:03
38 lines
2505 bytes
In article <3907@bingvaxu.cc.binghamton.edu> vu0310@bingvaxu.cc.binghamton.edu.cc.binghamton.edu (R. Kym Horsell) writes:
>In article <1990Aug29.095308.18522@sics.se> roland@sics.se (Roland Karlsson) writes:
>\\\
>>the trail will be effected at !.  So at backtracking (untrailing) you
>>will trap at the pointer to the heap.  The code on the heap will be
>>executed and thereby the old value restored.  So a ! will NOT make
>>the change permanent.
>
...
>The version of setarg/3 I have uses the *stack* to remember the
>fact that a given argument (i.e. part of the term structure
>stored on the heap) has been changed -- in this respect it's just
>like other backtrack points.
>
>A cut therefore will forget the fact that the change was done
>and therefore it *won't* be restored on backtracking.

This is interesting. Is no-one out there using the trail to store
directly the old value together with its address? This is the
so-called value-trailing, as opposed to the usual address trailing
where only the address is trailed and on untrailing its contents
is reset to a free variable. Value trailing is necessary to implement
efficiently coroutining systems (yes, I know that it is possible
without, but not fast enough). It was already present in MU-Prolog.
Once this mechanism is available, it can also be used to implement
backtrackable destructive assignment, if someone has to have it.
It seems to be much simpler and less space-consuming than
the two approaches mentioned above. Why to trail a pointer
to a code that restores the value if you can trail the value itself?
A cut of course does not prevent the restoring of the previous value,
like in Karlsson's approach.

--Micha Meier
--
USA     micha%ecrc.de@pyramid.com	MAIL	Micha Meier
						ECRC, Arabellastr. 17
EUROPE  micha@ecrc.de				8000 Munich 81
						West Germany
Technical Details
Message-ID: <1032@ecrc.de>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!snorkelwacker!ira.uka.de!fauern!tumuc!guug!ecrc!micha
References: <90239.175243SCHMIED@DB0TUI11.BITNET> <3899@bingvaxu.cc.binghamton.edu> <1990Aug28.065353.13951@sics.se> <3904@bingvaxu.cc.binghamton.edu> <1990Aug29.095308.18522@sics.se> <3907@bingvaxu.cc.binghamton.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!snorkelwacker!ira.uka.de!fauern!tumuc!guug!ecrc!micha
From: micha@ecrc.de (Micha Meier)
Newsgroups: comp.lang.prolog
Subject: Re: Arrays in Prolog
Message-ID: <1032@ecrc.de>
Date: 3 Sep 90 12:03:51 GMT
References: <90239.175243SCHMIED@DB0TUI11.BITNET> <3899@bingvaxu.cc.binghamton.edu> <1990Aug28.065353.13951@sics.se> <3904@bingvaxu.cc.binghamton.edu> <1990Aug29.095308.18522@sics.se> <3907@bingvaxu.cc.binghamton.edu>
Sender: news@ecrc.de
Reply-To: micha@ecrc.de (Micha Meier)
Organization: ECRC
Lines: 38