await map -> $delay { start { sleep $delay ; say $delay } }, <6 8 1 12 2 14 5 2 1 0>;
0 1 1 2 2 5 6 8 12 14
This can also be written using reactive programming:
#!/usr/bin/env raku use v6; react whenever Supply.from-list(@*ARGS).start({ .&sleep // +$_ }).flat { .say }
$ ./sleep-sort 1 3 5 6 2 4 1 2 3 4 5 6
Last updated 1 year ago