Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

[svn:perl6-synopsis] r14532 - doc/trunk/design/syn
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 <larry@wall.org>
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

Report this thread to moderator Post Follow-up to this message
Old Post
audreyt@cvs.perl.org
04-03-08 12:14 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL 6 Language archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 10:08 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.