Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!batcomputer!sun.soe.clarkson.edu!gary From: gary@milo.mcs.clarkson.edu (Gary Levin) Newsgroups: comp.lang.misc Subject: Re: flexible arrays Keywords: programming languages, flexible arrays. Message-ID: Date: 31 Jan 89 16:43:00 GMT References: <21@euteal.UUCP> Sender: news@sun.soe.clarkson.edu Organization: Clarkson University, Postdam NY Lines: 45 In-reply-to: mart@euteal.UUCP's message of 30 Jan 89 17:57:07 GMT In article <21@euteal.UUCP> mart@euteal.UUCP (Mart van Stiphout) writes: Some time ago I initiated a discussion on the Turing Language syntax, mainly the loops and list parts. ... What I really like are arrays. They have numerous advantages: 1. they can be processed easily. 2. elements can be accessed randomly in a cheap manner. 3. you don't have to mess around with pointers. 4. you don't have to allocate memory. ... I hereby propose to do away with linear linked lists. Instead we should use flexible arrays or sparse arrays. A sparse array can be thought of as a linked list but not implemented as one. The only thing I have to do is to declare a flexible array. The system does: 1. allocation of new array elements as soon as I refer to a non-existing one. 2. efficient storage of the used array elements: for example by some kind of dynamic hashing technique. The result could be something like the arrays you can use in the AWK programming language. These are very flexible and easy to use. The advantages are: no messing around with pointers, no memory trouble, easy acessing, easier to read programs and all this at the cost of (I think) a reasonable amount op cpu time. There are existing, readily available languages that provide what you describe. SNOBOL tables can be indexed by objects of ANY type, and grow dynamically at need. Icon provides both tables and lists in just the sense that you described, even permiting you to insert or delete elements, adjusting the indices accordingly. The language SETL also provided this power in terms of tuples (origin 1 arrays, adjustable length) and smaps (sets of ordered pairs to represent arbitrary mappings). I have implemented much of SETL as ISETL, which is an interactive version that runs under Unix, VMS, MS-DOS, and MacIntosh systems. Those interested in ISETL can FTP source from clutx.clarkson.edu in directory pub/ISETL, or you can write to me. If you FTP the source, just drop me a note listing your school and the type of machines that you intend to run it on. I am trying to keep track of such details. -- Gary Levin/Dept of Math & CS/Clarkson Univ/Potsdam, NY 13676/(315) 268-2384 BitNet: gary@clutx Internet: gary@clutx.clarkson.edu