Skip to content
No description, website, or topics provided.
Other
  1. Other 100.0%
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
t
.travis.yml
META6.json
README.md

README.md

Build Status

SupplyTimeWindow

use SupplyTimeWindow;

my $s = Supplier.new;
my $t = $s.Supply.time-window: 1;

start react whenever $t { .say }
                                
for ^10 -> $i { $s.emit: $i; sleep .5.rand }

SupplyTimeWindow creates time-window() new method on Supplyies that receives the size of the time window in seconds. Every time the original Supply emits, it will emit an Array with each value emitted less than time window's size seconds.

multi method time-window($seconds --> Supply) {...}

It also accepts a optional named parameter transform, it's a Callable that will be used to transform the time window array.

multi method time-window($seconds, :&transform! --> Supply) {...}
You can’t perform that action at this time.