🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #1120

Re: Arrays in Prolog

#1120
From: R. Kym Horsell
Date: Wed, 29 Aug 1990 15:14
30 lines
1956 bytes
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.

Oh. From your previous post I presumed we had implemented the same
thing, but apparently not quite.

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.

We have the possibility of doing things like communicating
between alternatives in a disjunction, or implementing arrays
(does Sicstus allow large arities for structs -- it's
a bit hard to do (e.g. in "copyterm" -- part of the assert/clause
mechanism) everywhere)? This comes in handy for implementing
bagof/3, etc.

I realize this is all a bit nasty, and use of setarg/3 is open to abuse, 
but at the moment the system I have is only for my use (and if you saw the 
state of the documentation it would be obvious why).

-Kym Horsell
Technical Details
Message-ID: <3907@bingvaxu.cc.binghamton.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!leah!bingvaxu!vu0310
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>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!leah!bingvaxu!vu0310
From: vu0310@bingvaxu.cc.binghamton.edu (R. Kym Horsell)
Newsgroups: comp.lang.prolog
Subject: Re: Arrays in Prolog
Message-ID: <3907@bingvaxu.cc.binghamton.edu>
Date: 29 Aug 90 15:14:56 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>
Reply-To: vu0310@bingvaxu.cc.binghamton.edu.cc.binghamton.edu (R. Kym Horsell)
Organization: SUNY Binghamton, NY
Lines: 30