🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #1182

Re: Arrays in Prolog

#1182
From: Peter G Ludemann
Date: Wed, 12 Sep 1990 00:39
14 lines
1261 bytes
IBM-Prolog has arrays and "item-lists" (like arrays, except
that the indexes are arbitrary atoms).  They are O(1) for
access and update.  Updates are undone on backtracking.
(There are also "global terms" which provide associative
tables whose changes may be undone by backtracking or not,
at the programmers control).

I have used item-lists to implement a constraint logic programming
version of n-queens: the algorithm is essentially linear on "n"
whereas even the best of the permute-and-test algorithms is exponential
(for n=20, the constraint version took 40 milliseconds and I gave
up waiting for the conventional program after a few minutes).

- Peter Ludemann	prefered e-mail: ludemann@mlpvm1.iinus1.ibm.com
Technical Details
Message-ID: <33777@cup.portal.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!julius.cs.uiuc.edu!apple!portal!cup.portal.com!pgl
References: <3629@goanna.cs.rmit.oz.au> <9668@bunny.GTE.COM> <ALBERTO.90Aug31144731@yamuna.cs.umd.edu> <9680@bunny.GTE.COM> <11289@alice.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!julius.cs.uiuc.edu!apple!portal!cup.portal.com!pgl
From: pgl@cup.portal.com (Peter G Ludemann)
Newsgroups: comp.lang.prolog
Subject: Re: Arrays in Prolog
Message-ID: <33777@cup.portal.com>
Date: 12 Sep 90 00:39:27 GMT
References: <3629@goanna.cs.rmit.oz.au> <9668@bunny.GTE.COM>
  <ALBERTO.90Aug31144731@yamuna.cs.umd.edu> <9680@bunny.GTE.COM>
  <11289@alice.UUCP>
Organization: The Portal System (TM)
Lines: 14