Author: audreyt
Date: Wed Apr  2 08:56:38 2008
New Revision: 14532

Modified:
   doc/trunk/design/syn/S09.pod

Log:
* S09/"Parallelized parameters and autothreading":

  @a[$i, $j] etc in examples should read @a[$i; $j] instead.

  Also, clarify that "do -> { ... }" is intentionally calling the
  block via the do-once loop syntax, because a pointy sub at that
  point wouldn't trigger the statement-level-bare-block-autocall
  rule.

  Reported by: John M. Dlugosz
    

Modified: doc/trunk/design/syn/S09.pod
==============================================================================
--- doc/trunk/design/syn/S09.pod        (original)
+++ doc/trunk/design/syn/S09.pod        Wed Apr  2 08:56:38 2008
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 13 Sep 2004
-  Last Modified: 17 Mar 2008
+  Last Modified: 2 Apr 2008
   Number: 9
-  Version: 24
+  Version: 25
 
 =head1 Overview
 
@@ -1044,28 +1044,34 @@
 In the abstract (and often in the concrete), this puts an implicit
 loop around the block of the closure that visits all the possible
 subscript values for that dimension (unless the parameter is actually
-supplied to the closure, in which case that is what is used as the
-slice subscript).  This implicit loop is assumed to be parallelizable.
+supplied to the closure, in which case the supplied value is used as
+the slice subscript instead).
+
+This implicit loop is assumed to be parallelizable.
 
 So to write a typical tensor multiplication:
 
     Cijkl = Aij * Bkl
 
-you can just write this:
+you can simply call a closure with no arguments, allowing the C<autoindex>
+pragma to fill in the defaults:
 
     use autoindex;
-    do { @c[$^i, $^j, $^k, $^l] = @a[$^i, $^j] * @b[$^k, $^l] };
-
-or equivalently:
+    -> $i, $j, $k, $l { @c[$i; $j; $k; $l] = @a[$i; $j] * @b[$k; $l] }();
 
-    -> $i, $j, $k, $l { @c[$i, $j, $k, $l] = @a[$i, $j] * @b[$k, $l] }();
-
-or even:
+or you can use the C<do BLOCK> syntax (see L<S04/"The do-once loop">) to
+call that closure, which also implicitly iterates:
 
+    use autoindex;
     do -> $i, $j, $k, $l {
-        @c[$i, $j, $k, $l] = @a[$i, $j] * @b[$k, $l]
+        @c[$i; $j; $k; $l] = @a[$i; $j] * @b[$k; $l]
     }
 
+or even use placeholder variables instead of a parameter list:
+
+    use autoindex;
+    do { @c[$^i; $^j; $^k; $^l] = @a[$^i; $^j] * @b[$^k; $^l] };
+
 That's almost pretty.
 
 It is erroneous for an unbound parameter to match multiple existing array

Reply via email to