Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!ukc!cam-cl!news From: ksh@ely.cl.cam.ac.uk (Kish Shen) Newsgroups: comp.lang.prolog Subject: Re: Arrays in Prolog Message-ID: <1990Sep13.162701.16271@cl.cam.ac.uk> Date: 13 Sep 90 16:27:01 GMT References: <90239.175243SCHMIED@DB0TUI11.BITNET> <1990Sep13.071715.4852@sics.se> Sender: news@cl.cam.ac.uk (The news facility) Reply-To: ksh@cl.cam.ac.uk (Kish Shen) Lines: 28 In article <1990Sep13.071715.4852@sics.se>, matsc@sics.se (Mats Carlsson) writes: |> A comment to Kish's note: Presumably your scheme requires an extra |> "special trail pointer" register and a corresponding slot in every |> choicepoint. This means extra work when creating choicepoints and at |> backtracking. At backtracking you would also need to check whether |> there are special trail items to untrail. Yes, however the cost seems small to me compared to doubling the trail size (which increase the cost of detrailing automatically, as you need to detrail two cells instead of one whatever you do), or checking for a special bit, which has to be done for every trailed value. Note that there might be more than one "special" type of trailing: you may want to trail delayed goals and destructive assignments, and (in my case) dependent variables. So you may need a tag instead of a bit, and the checking is more expensive, so it seems to make sense to make the "normal" trailing as fast as possible, without the need to check any tags. Of course if you are trailing an old value that is destructively assigned to, you need to detrail your special trail before the normal trail. Kish Shen (ksh@cl.cam.ac.uk) Computer Lab. University of Cambridge Cambridge, UK