Raku Books / Perl 6 Calendar 2019

April

Perl 6 Calendar 2019 — April

Implement the Sleep sort algorithm

my @data = 5, 3, 1, 4, 2;
await gather for @data -> $d {
    take start {
        sleep $d;
        say $d;
    }
}

🧵 This program uses concurrency (promises, threads). The in-browser engine (Raku.js) is single-threaded and can’t run it yet — try it on your own computer.

Course navigation

March   |   May