Created
November 15, 2022 01:24
-
-
Save gfldex/c69612be47e078d090467bf3972fc3f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub limit-rate(Supply $in, $per-seconds = 1 --> Supply:D) { | |
my $out = Supplier::Preserving.new; | |
start react whenever $in -> \value { | |
$out.emit: value; | |
sleep(1 / $per-seconds); | |
} | |
$out.Supply; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment