Newsgroups: alt.lang.design,comp.lang.c++,comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!swrinde!pipex!uunet!franz.com!franz!smh
From: smh@Franz.COM (Steve Haflich)
Subject: Re: Comparing productivity: LisP against C++ (was Re: Reference Counting)
In-Reply-To: marcoxa@mosaic.nyu.edu's message of 20 Dec 1994 06:11:00 GMT
Message-ID: <SMH.94Dec23175358@vapor.Franz.COM>
Followup-To: alt.lang.design,comp.lang.c++,comp.lang.lisp
Sender: news@franz.com
Nntp-Posting-Host: vapor
Organization: Franz Inc., Berkeley, CA
References: <19941203T221402Z.enag@naggum.no> <BUFF.94Dec15103904@pravda.world>
	<D0xAIp.3Dn@rheged.dircon.co.uk> <vrotneyD11MDv.Ks7@netcom.com>
	<vogtD12y8D.HLL@netcom.com> <3d5alh$6j7@celebrian.otago.ac.nz>
	<MARCOXA.94Dec20011100@mosaic.nyu.edu>
Date: Sat, 24 Dec 1994 01:53:58 GMT
Lines: 26
Xref: glinda.oz.cs.cmu.edu comp.lang.c++:104766 comp.lang.lisp:16182

In article <MARCOXA.94Dec20011100@mosaic.nyu.edu> marcoxa@mosaic.nyu.edu (Marco Antoniotti) writes:

   From: marcoxa@mosaic.nyu.edu (Marco Antoniotti)
   Newsgroups: alt.lang.design,comp.lang.c++,comp.lang.lisp
   Date: 20 Dec 1994 06:11:00 GMT

   ... I tried to write a "multidimensional"
   'read-sequence' (a function with that name will be in the upcoming CL
   ANSI, the first ANSI OO Language standard), decided it was not worth
   the effort

The trick is to use displaced arrays, as with this convenient and
portable helper function:

    (defun make-displaced-vector (array)
      (make-array (array-total-size array)
		  :element-type (array-element-type array)
		  :displaced-to array))

This returns a one-dimensional array that is displaced to the same
storage as the argument array, whatever its rank and dimensions.  Yes,
it works correctly even for zero-rank arrays.

In Common Lisp the correspondence between elements of the two arrays
is well defined so the returned vector can be used computationally and
also passed to READ-SEQUENCE and WRITE-SEQUENCE.
