🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #1138

Re: Arrays in Prolog

#1138
From: Richard Tobin
Date: Thu, 30 Aug 1990 17:20
25 lines
1881 bytes
In article <3906@bingvaxu.cc.binghamton.edu> vu0310@bingvaxu.cc.binghamton.edu.cc.binghamton.edu (R. Kym Horsell) writes:
>2) By using a cut after setarg you *lose* the backtrack
>point so the modification becomes ``permanent'', which
>was the whole point in my previous message. 

I have never used setarg, but it seems you are confusing two things:
the ability to change the value of an instantiated variable, and the
ability to preserve the value of a variable when backtracking.

Cut doesn't normally affect the resetting of variables on
backtracking.  If X is uninstantiated and I do   X=1, !   then X will
become uninstantiated when I backtrack past the unification, regardless
of the cut.  This doesn't involve a choice point, just the trail.

Similarly, if a predicate is added which can alter an already-instantiated
variable, why should cut affect whether it is reset?

If you really want assignments (or just pain instantiations) that are
not reset by backtracking, don't overload cut for it, use something else.

-- Richard
-- 
Richard Tobin,                       JANET: R.Tobin@uk.ac.ed             
AI Applications Institute,           ARPA:  R.Tobin%uk.ac.ed@nsfnet-relay.ac.uk
Edinburgh University.                UUCP:  ...!ukc!ed.ac.uk!R.Tobin
Technical Details
Message-ID: <3321@skye.ed.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!edcastle!aiai!richard
References: <90239.175243SCHMIED@DB0TUI11.BITNET> <3899@bingvaxu.cc.binghamton.edu> <1990Aug28.065353.13951@sics.se> <3904@bingvaxu.cc.binghamton.edu> <1162@cluster.cs.su.oz> <3906@bingvaxu.cc.binghamton.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!edcastle!aiai!richard
From: richard@aiai.ed.ac.uk (Richard Tobin)
Newsgroups: comp.lang.prolog
Subject: Re: Arrays in Prolog
Message-ID: <3321@skye.ed.ac.uk>
Date: 30 Aug 90 17:20:57 GMT
References: <90239.175243SCHMIED@DB0TUI11.BITNET> <3899@bingvaxu.cc.binghamton.edu> <1990Aug28.065353.13951@sics.se> <3904@bingvaxu.cc.binghamton.edu> <1162@cluster.cs.su.oz> <3906@bingvaxu.cc.binghamton.edu>
Reply-To: richard@aiai.UUCP (Richard Tobin)
Organization: AIAI, University of Edinburgh, Scotland
Lines: 25