Synsema

Concurrency

Real multi-core parallelism, no GIL. parallel_map runs a task over a list concurrently, results in input order, with a bounded number of workers.

let results be parallel_map(fetch_user, ids, 50)

Fan-out and merge

chunk splits a list into batches — the "10k as 10x1000, then merge" pattern:

let batches be chunk(items, 1000)
let partial be parallel_map(process_batch, batches, 10)
let merged be flatten(partial)

parallel_map(task, list) returns the same result and order as apply(task, list) — it only adds concurrency. Fail-fast: the first error cancels the rest (wrap the task in try/recover to collect partial results).