-
-
Save zoffixznet/70cb09f80a48247839a54b1755575459 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 sleep_sort (*@list where .all >= 0) { | |
my $channel = Channel.new; | |
await @list.map: -> $delay { | |
Promise.start({ | |
sleep $delay / 1000; | |
$channel.send($delay); | |
}); | |
}; | |
$channel.close; | |
return $channel.list; | |
} | |
my @a = sleep_sort(3,2,1,5,4) xx 500; | |
say all(@a).elems == 5 ?? "pass" !! "fail"; | |
say now - INIT now; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment