Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library

Comment by librasteve

18 hours ago

Here's the other Gleam concurrency example in Raku for good measure:

  my @promises;

  sub MAIN() {
    # Run loads of green threads, no problem
    for ^200_000 {
      spawn-greeter($++);
    }

    await Promise.allof(@promises);
  }

  sub spawn-greeter($i) {
    @promises.push: start {
      say "Hello from $i";
    }
  }

0 comments

librasteve

Reply

No comments yet

Contribute on Hacker News ↗

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities