Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add preliminary doc for Supply.share
  • Loading branch information
lizmat committed Dec 13, 2015
1 parent 592e4a5 commit c1510f6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions doc/Type/Supply.pod
Expand Up @@ -217,6 +217,21 @@ Creates an on-demand supply from the values passed to this method.
$s.tap(&say); # 1\n2\n3\n
$s.done;
=head2 method share
method share(Supply:D:) returns Supply:D
my $s = Supply.from-list(^100000).share;
my @first;
$s.tap: { @first.push($_) };
my @second;
$s.tap: { @second.push($_) };
say @first + @second;
Creates a live supply from an on-demand supply, thus making it possible to
share the values of the on-demand supply on multiple taps, instead of each
tap seeing all values from the on-demand supply.
=head2 method flat
method flat(Supply:D:) returns Supply:D
Expand Down

0 comments on commit c1510f6

Please sign in to comment.