Author: ruoso
Date: 2008-11-27 15:07:52 +0100 (Thu, 27 Nov 2008)
New Revision: 24091

Modified:
   docs/Perl6/Spec/S07-iterators.pod
Log:
[spec] small code examples on how to get the generic item iterator, lazy slice 
and lazy list

Modified: docs/Perl6/Spec/S07-iterators.pod
===================================================================
--- docs/Perl6/Spec/S07-iterators.pod   2008-11-27 13:57:34 UTC (rev 24090)
+++ docs/Perl6/Spec/S07-iterators.pod   2008-11-27 14:07:52 UTC (rev 24091)
@@ -140,22 +140,34 @@
 they can use a generic item iterator to consolidate the access to the
 input iterator, doing additional iterators when an empty capture is
 returned and holding additional values if more than one item is
-returned.
+returned. The following code will result in getting a generic item
+iterator:
 
+  my $foo <== @a;
+
+You can later do:
+
+  my $item = =$foo;
+
 =head2 Generic Lazy List
 
 The generic lazy list accepts an iterator as input, and consumes the
 iterator as the elements of the list are accessed but flattening and
-storing the already-evaluated elements.
+storing the already-evaluated elements. To obtain a generic lazy list,
+just do:
 
+  my @a <== @b;
+
 =head2 Generic Lazy Slice
 
 The generic lazy slice accepts an iterator as input, and consumes the
 iterator as the elements of the list are accessed but storing the
 already-evaluated elements as a bi-dimensional list, where the first
 dimension holds each iteration, and the second contains the return of
-each iteration.
+each iteration. To obtain a generic lazy slice, do:
 
+  my @@a <== map { ... }, 1,2,3;
+
 =head1 Additions
 
 Please post errors and feedback to perl6-language.  If you are making

Reply via email to