unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Kevin Ryde <user42@zip.com.au>
Subject: Re: doco array mapping
Date: Mon, 26 May 2003 10:34:25 +1000	[thread overview]
Message-ID: <87he7ilf5a.fsf@zip.com.au> (raw)
In-Reply-To: <87u1bven62.fsf@zip.com.au> (Kevin Ryde's message of "Fri, 16 May 2003 10:43:33 +1000")

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


  reply	other threads:[~2003-05-26  0:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-16  0:43 doco array mapping Kevin Ryde
2003-05-26  0:34 ` Kevin Ryde [this message]
2003-06-01 23:13   ` Marius Vollmer
2003-06-04 15:34     ` Kevin Ryde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87he7ilf5a.fsf@zip.com.au \
    --to=user42@zip.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).