[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Adjusting displaced arrays.



    Date: Tue, 28 May 85 11:21:20 EDT
    From: greek@DEC-HUDSON

    Erf!  I certainly should have objected to the incredible hair needed
    to implement adjustable arrays, pa'ticularly those which are displaced,
    back when we specified them.  However, I'd like to object now.

    I'd like to see a list of the uses people make of displaced and
    adjustable arrays.  Maybe there are only two or three real features
    that people use, and we could restrict ourselves to those.  I looked
    around here at DEC, and found exactly two uses:

    1.  Make an array bigger.  Obviously this could be done with MAKE-ARRAY
	and REPLACE.

    2.  Linearize a multidimensional array so that row-major references
	can be done.  This is useful, but an AREF-ROW-MAJOR function could
	probably do it more efficiently.

LispMs (which include Symbolics, and I believe LMI and TI for this
discussion) use displaced arrays for at least the following:
	NSUBSTRING (which is SUBSTRING, but shares storage)
	bitmaps (both for creating subwindows of windows, and for
		 redirecting an array (a) to a physical screen or (b) to
		 a bit save array.)
	de/en-capsulating network packets (e.g., the data of a packet is a
		string that shares storage with the packet; the string
		starts after the protocol header.)
I don't think we don't use it for your case (1); instead we do make a
new array, copy, and structure forwared the old to the new.  They can
also be used for your case (2), but I think the our function
SYS:%1D-AREF subsumes the need.

    It seems to me that any set of rules that require AREF to iterate to
    find the data ought to be simplified.  So much for inline code.