Parallel collection work

Use async tasks to overlap waiting and std.parallel when collection work should use multiple CPU cores. It runs named functions through isolates for map, each, chunked, or long-lived workers.

Prefer chunked for many small items so each worker processes a slice instead of starting once per item. Results preserve item order.

fn squares(values: [int]) -> [int] {
  [value * value for value in values]
}

fn main() {
  println(std.parallel.chunked("squares", [1, 2, 3, 4], 2))
}
Run locally
moon run main.mn
Ctrl/⌘+Enter checks the current lesson.