Qu

join

Builtin index · Concurrency

result = join(w) or join(list[, delimiter])

Input: w · Output: result

What it is

Two unrelated forms selected by the argument's type. On a Worker handle w (from spawn): blocks the calling thread until that worker finishes, then returns its function's return value (whatever type that function produces), or re-raises whatever error the worker's body raised as an ordinary runtime error here on the caller. Consumes the handle — joining the same worker twice is an error. On a List of strings list (with an optional string delimiter, default ""): the unrelated collection form, concatenating every element into one string with delimiter inserted between each pair — the inverse of split.

Overloads

w can be Worker, List, or string.

2 forms. Each carries its own inputs, outputs and worked example — pick the tab for the one you are calling.

CodeInputOutputDescription
result = join(w) or join(list[, delimiter])
w Workernot documented yet
result string
Blocks until that worker finishes, then returns its function's return value, or re-raises whatever error the worker's body raised.

Examples

Written for this form and run by the build -- the output below is what the engine actually produced.

heavy(n) := n * n
w = spawn("heavy", 6)
print(join(w))   # 36

output
36
CodeInputOutputDescription
result = join(w) or join(list[, delimiter])
w List, string, or Workernot documented yet
result string
list a List of strings, with an optional delimiter (default ""). The unrelated collection form — concatenates every element into one string, the inverse of split — selected purely because the first argument isn't a Worker handle.

Examples

Written for this form and run by the build -- the output below is what the engine actually produced.

print(join(["a", "b", "c"]))        # "abc"

print(join(["a", "b", "c"], "-"))   # "a-b-c"

output
abc
a-b-c

How it works

join(w) blocks until worker w finishes and returns its result — or re-raises whatever error the worker's function body raised, exactly as if it had been called directly (never silently swallowed). Consumes the handle: joining the same worker twice is a clear error, not a second wait. join(list[, delimiter]) — collection form (§ collections, 2026-08-24): the natural inverse of split, concatenating a List of strings with delimiter between each ("" if omitted). Dispatches on arg0's type, same "one name, arg-type decides" pattern remove above also uses.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.