From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.lisp.guile.devel Subject: Re: doco array mapping Date: Mon, 26 May 2003 10:34:25 +1000 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <87he7ilf5a.fsf@zip.com.au> References: <87u1bven62.fsf@zip.com.au> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1053909450 1833 80.91.224.249 (26 May 2003 00:37:30 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 26 May 2003 00:37:30 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon May 26 02:37:27 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19K5zS-0000Su-00 for ; Mon, 26 May 2003 02:37:27 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19K5ya-0005bO-4r for guile-devel@m.gmane.org; Sun, 25 May 2003 20:36:32 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19K5xs-0004wP-AX for guile-devel@gnu.org; Sun, 25 May 2003 20:35:48 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19K5x0-0003s7-At for guile-devel@gnu.org; Sun, 25 May 2003 20:34:55 -0400 Original-Received: from snoopy.pacific.net.au ([61.8.0.36]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19K5wp-0003cy-R5 for guile-devel@gnu.org; Sun, 25 May 2003 20:34:44 -0400 Original-Received: from sunny.pacific.net.au (sunny.pacific.net.au [203.2.228.40]) h4Q0YbPB032122 for ; Mon, 26 May 2003 10:34:37 +1000 Original-Received: from wisma.pacific.net.au (wisma.pacific.net.au [210.23.129.72]) by sunny.pacific.net.au with ESMTP id h4Q0YbQg005530 for ; Mon, 26 May 2003 10:34:37 +1000 (EST) Original-Received: from localhost (ppp29.dyn228.pacific.net.au [203.143.228.29]) by wisma.pacific.net.au (8.12.9/8.12.9) with ESMTP id h4Q0YZYZ028378 for ; Mon, 26 May 2003 10:34:36 +1000 (EST) Original-Received: from gg by localhost with local (Exim 3.35 #1 (Debian)) id 19K5wZ-0000T2-00; Mon, 26 May 2003 10:34:27 +1000 Original-To: guile-devel@gnu.org Mail-Copies-To: never In-Reply-To: <87u1bven62.fsf@zip.com.au> (Kevin Ryde's message of "Fri, 16 May 2003 10:43:33 +1000") User-Agent: Gnus/5.090019 (Oort Gnus v0.19) Emacs/21.2 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:2443 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:2443 New words to propose for the array mapping chapter. The main idea is to make the formal parameters talked about in the text match what's in the prototypes. I found "lra" and stuff a bit confusing, until the penny dropped. I also replaced the examples for array-index-map! with something a little more realistic. Not a lot more, but a little at least :-). Suggestions for something simple but illustrative would be welcome. Array Mapping ------------- - Scheme Procedure: array-map! dst proc src1 ... srcN - Scheme Procedure: array-map-in-order! dst proc src1 ... srcN - C Function: scm_array_map_x (dst, proc, srclist) Set each element of the DST array to values obtained from calls to PROC. The value returned is unspecified. Each call is `(PROC ELEM1 ... ELEMN)', where each ELEM is from the corresponding SRC array at the DST index. `array-map-in-order!' makes the calls in row-major order, `array-map!' makes them in an unspecified order. The SRC arrays must have the same number of dimensions as DST, and must have a range for each dimension which covers the range in DST. This ensures all DST indices are valid in each SRC. - Scheme Procedure: array-for-each proc src1 ... srcN - C Function: scm_array_for_each (proc, src1, srclist) Apply PROC to each tuple of elements of SRC1 ... SRCN, in row-major order. The value returned is unspecified. - Scheme Procedure: array-index-map! dst proc - C Function: scm_array_index_map_x (dst, proc) Set each element of the DST array to values returned by calls to PROC. The value returned is unspecified. To generate each DST element, a call `(PROC I1 ... IN)' is made, where each I1...IN is the destination index, one parameter for each dimension. The order in which the calls are made is unspecified. For example, to create a 4x4 matrix representing a cyclic group, / 0 1 2 3 \ | 1 2 3 0 | | 2 3 0 1 | \ 3 0 1 2 / (define a (make-array #f 4 4)) (array-index-map! a (lambda (i j) (modulo (+ i j) 4))) _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel