From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Marius Vollmer Newsgroups: gmane.lisp.guile.devel Subject: Re: doc make-shared-array Date: Mon, 28 Feb 2005 03:25:58 +0100 Message-ID: <874qfxfmix.fsf@zagadka.de> References: <87r7jmycar.fsf@zip.com.au> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1109558147 12329 80.91.229.2 (28 Feb 2005 02:35:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 28 Feb 2005 02:35:47 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Feb 28 03:35:47 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D5al1-00065L-KL for guile-devel@m.gmane.org; Mon, 28 Feb 2005 03:35:39 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D5b3I-0006SV-9L for guile-devel@m.gmane.org; Sun, 27 Feb 2005 21:54:32 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D5b2p-0006M9-AU for guile-devel@gnu.org; Sun, 27 Feb 2005 21:54:03 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D5b2j-0006Hk-5J for guile-devel@gnu.org; Sun, 27 Feb 2005 21:53:57 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D5b2j-0006Hh-12 for guile-devel@gnu.org; Sun, 27 Feb 2005 21:53:57 -0500 Original-Received: from [195.253.8.218] (helo=mail.dokom.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1D5abl-0003GB-BK for guile-devel@gnu.org; Sun, 27 Feb 2005 21:26:05 -0500 Original-Received: from [195.253.16.122] (helo=zagadka.ping.de) by mail.dokom.net with smtp (Exim 4.34) id 1D5abk-00080c-KW for guile-devel@gnu.org; Mon, 28 Feb 2005 03:26:04 +0100 Original-Received: (qmail 4710 invoked by uid 1000); 28 Feb 2005 02:25:58 -0000 Original-To: guile-devel@gnu.org In-Reply-To: <87r7jmycar.fsf@zip.com.au> (Kevin Ryde's message of "Sat, 12 Feb 2005 09:14:20 +1100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org X-MailScanner-To: guile-devel@m.gmane.org Xref: main.gmane.org gmane.lisp.guile.devel:4806 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:4806 Kevin Ryde writes: > Expanded words about make-shared-array, trying to clarify what linear > means, and adding lots of example usages. Nice, thanks! > [...] and perhaps enclose-array too (if anyone can explain what it > actually does :-). Yeah, strange critters, those enclosed arrays. Enclosing an array is like creating a new array where each element is a shared array created from the original array. An enclosed array is different from this in that the shared arrays are created 'on-demand' during array-ref. > The quotient/remainder example flattening two dims to one works I > think, but I'm not sure it obeys a strict reading of what's described > for a "linear" mapfunc. It is not linear (and not affine) and make-shared array only works by accident in this case, I think. For example, bounds checking is not done independently for each dimension, but only for the start and end points in the lexical ordering of all possible indices, or something like that. Also, the map function is not really linear, it is affine (because of the offset). > An array can be flattened from say two dimensions to one by having > the MAPFUNC translate portions of the new array to rows in the old, > > (make-shared-array #2((a b c d) (e f g h) (i j k l)) > (lambda (i) (list (quotient i 4) > (remainder i 4))) > 12) > => #(a b c d e f g h i j k l) This should be removed. An array can be flattened with array-contents. > The opposite is possible too, taking say a one dimensional array > and considering portions of it as rows, > > (make-shared-array #1(a b c d e f g h i j k l) > (lambda (i j) (list (+ (* i 3) j))) > 4 3) > => #2((a b c) (d e f) (g h i) (j k l)) But this is OK, of course. > With a negation on an index, the order that elements appear can be > reversed. This is the sort of thing `array-transpose' below does. Hmm, transpose-array (not array-transpose) permutes the indices, it does not reverse the direction within one dimension. -- GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405 _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel