@@ -547,20 +547,56 @@ process, working synchronously, C<grep> on a Supply has values I<pushed>
547
547
through it, and pushes those that match the filter onwards to anything that
548
548
taps it.
549
549
550
- The following methods are available on a C<Supply>:
550
+ The following methods are available on an instantiated C<Supply> (C<$s> in
551
+ these examples):
551
552
552
553
=over
553
554
554
555
=item flat
555
556
557
+ my $f = $s.flat;
558
+
559
+ Produces a C<Supply> in which all values of the original supply are flattened.
560
+
561
+ =item do
562
+
563
+ my $seen;
564
+ my $d = $s.do( {$seen++} );
565
+
566
+ Produces a C<Supply> that is identical to the original supply, but will execute
567
+ the given code for its side-effects.
568
+
556
569
=item grep
557
570
571
+ my $g = $s.grep( * > 5 );
572
+
573
+ Produces a C<Supply> that only provides values that are greater than 5.
574
+
558
575
=item map
559
576
577
+ my $m = $s.map( * * 5 );
578
+
579
+ Produces a C<Supply> that provides its original's Supply values multiplied by 5.
580
+
581
+ my $m2 = $s.map( { $_ xx 2 } );
582
+
583
+ Produces a C<Supply> that provides its original's Supply values twice.
584
+
560
585
=item uniq
561
586
587
+ my $u = $s.uniq( :as( {$_} ), :with( &[===] ) );
588
+
589
+ Produces a C<Supply> that only provides unique values, as defined by the
590
+ optional C<as> and C<with> named parameters (same as L<List.uniq>).
591
+
562
592
=item squish
563
593
594
+ my $q = $s.squish( :as( {$_} ), :with( &[===] ) );
595
+
596
+ Produces a C<Supply> that only provides sequentially different values, as
597
+ defined by the optional C<as> and C<with> named parameters (same as
598
+ L<List.squish>).
599
+
564
600
=back
565
601
566
602
There are some others that will only publish a result or results if C<done> is
0 commit comments