Qu

queue

Builtin index · Concurrency

result = queue()

Input: no input · Output: result

What it is

Takes no arguments. Creates an empty deferred-job list.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = queue()no input
result Queue
Returns a Queue handle (type(q) == "queue"); cloning it shares the same underlying list of pending jobs, not a separate copy.

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

square(x) := x * x
pool workers with cpu=2
end pool
q = queue()
q.push("square", 3)
print(run q on workers)   # (9)

output
(9)

from concurrency

square(x) := x * x

pool workers with cpu=4
end pool

q = queue()
for i in 0 to 4
    q.push("square", i)
end for

results = run q on workers
print(results)              # (0, 1, 4, 9, 16)

output
(0, 1, 4, 9, 16)

from concurrency

function square(x)
    return x * x
end function

pool workers with cpu=4
    policy = round_robin        # or priority | fair | affinity

    on full = queue             # or reject | spill_to(cpu)

end pool

q = queue()
for i in 0 to 9
    q.push("square", i)         # enqueue a deferred call by name + args

end for

results = run q on workers
print(results)

from tour

square(x) := x * x                    # still needed locally: `run` validates

                                       # every queued function name against

                                       # the CALLING script's own functions

                                       # before dispatching anything, even a

                                       # job that will actually run remotely


pool workers with cpu=2, remote=("192.168.1.50:9000", "192.168.1.51:9000")
end pool

q = queue()
for i in 0 to 9
    q.push("square", i)
end for

results = run q on workers            # some jobs run locally, some remote —

                                       # one ordered List either way

from tour

How it works

queue() (§47.3 job-queue/worker-pool, 2026-08-26) — a new, empty deferred-job queue; see Value::Queue's own doc comment for why this is distinct from the generic FIFO *collection* type §47.4 also names queue().

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