Course of Raku / Functional, concurrent, reactive, and web programming / Concurrent programming / Promises / Chaining and combining
Quiz — Combining promises
What does the following program print?
my @jobs = (start { 2 }), (start { 3 });
say [*] await @jobs;| 0 | 5 |
| 1 | 6 |
| 0 | (2 3) |
| 0 | 23 |
await @jobs returns the results of the two promises in
order, (2, 3). The reduce metaoperator [*]
multiplies them, giving 6.