Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!mit-eddie!bloom-beacon!eru!hagbard!sunic!sics.se!sics.se!lhe From: lhe@sics.se (Lars-Henrik Eriksson) Newsgroups: comp.lang.prolog Subject: Re: Arrays in Prolog Message-ID: <1990Aug30.073456.2998@sics.se> Date: 30 Aug 90 07:34:56 GMT Sender: news@sics.se Organization: Swedish Institute of Computer Science Lines: 30 References:<90239.175243SCHMIED@DB0TUI11.BITNET> <1600024@otter.hpl.hp.com> <1421@quintus.UUCP> In article <1421@quintus.UUCP> pds@quintus.UUCP (Peter Schachte) writes: > writes: > >First of all: it is nonesense to say that one should not use arrays > >becauses it involves destructive assignment. > > Hold on a minute. What do arrays have to do with destructive assignment? > It is perfectly possible to have arrays without having destructive > assignment, and vice versa. Mats Carlsson and Ken Kahns LM-Prolog system had an array implementation where you assigned array elements by creating a (conceptual) copy of the array with one element changed. The array primitives thus did not do any (visible) side effects. (Of course the arrays were not actually copied.) Provided that once an array element had been set, the old version of the array was not used anymore, this scheme guaranteed constant time access and update of the arrays (with virtually no overhead). If older versions of an array was used, the access and update time increased linearly with the number of changes made since that version. I haven't seen this or any array scheme with similar properties implemented in any other Prolog than LM-Prolog. An article about this was presented at the 2nd international Logic Programming conference in Uppsala 1984. Lars-Henrik Eriksson Internet: lhe@sics.se Swedish Institute of Computer Science Phone (intn'l): +46 8 752 15 09 Box 1263 Telefon (nat'l): 08 - 752 15 09 S-164 28 KISTA, SWEDEN