summaryrefslogtreecommitdiffhomepage
path: root/chapel.html.markdown
diff options
context:
space:
mode:
authorIan Bertolacci <ian.bertolacci@gmail.com>2015-08-02 14:35:41 -0700
committerIan Bertolacci <ian.bertolacci@gmail.com>2015-08-02 14:35:41 -0700
commit11ca1012e402bbc51f70283c4e20ee8bf31deb7f (patch)
treec5b33f7d97edcac351073f82b30c7b22bfcdd25a /chapel.html.markdown
parentc2f85b27b5620054bb0306ee4730cefff60ad87c (diff)
Clarified some wording on the zipper iterator. Changed the example to something more simple and informative.
Diffstat (limited to 'chapel.html.markdown')
-rw-r--r--chapel.html.markdown12
1 files changed, 7 insertions, 5 deletions
diff --git a/chapel.html.markdown b/chapel.html.markdown
index 0d1d38dc..cfde0454 100644
--- a/chapel.html.markdown
+++ b/chapel.html.markdown
@@ -533,11 +533,13 @@ iter oddsThenEvens( N: int ): int {
for i in oddsThenEvens( 10 ) do write( i, ", " );
writeln( );
-// The 'zippered' iterator is an iterator that takes two or more iterators that
-// have the same number of iterations and zips them together into one stream
- // Ranges have implicit iterators
-for (odd, even) in zip( 1..#10 by 2, 2..#10 by 2 ) do
- writeln( (odd, even) );
+// We can zipper together two or more iterators (who have the same number
+// of iterations) using zip() to create a single zipped iterator, where each
+// iteration of the zipped iterator yields a tuple of one value yielded
+// from each iterator.
+ // Ranges have implicit iterators
+for (positive, negative) in zip( 1..5, -5..-1) do
+ writeln( (positive, negative) );
// Classes are similar to those in C++ and Java.
// They currently lack privatization