Model queue-like work as a deterministic Swift array and loop.

Work Queue Panel

extra
work_queue_panel.swift
Replay: real traced execution (multi-file project)
let extra = "audit"
var tasks = ["read", extra, "write"]
var log: [String] = []
var total = 0

for task in tasks {
    log.append("run:\(task)")
    total += 1
}

let joined = log.joined(separator: ",")

print("extra=\(extra)")
print("log=\(joined)")
print("total=\(total)")
let extra = "review"
var tasks = ["read", extra, "write"]
var log: [String] = []
var total = 0

for task in tasks {
    log.append("run:\(task)")
    total += 1
}

let joined = log.joined(separator: ",")

print("extra=\(extra)")
print("log=\(joined)")
print("total=\(total)")
let extra = "ship"
var tasks = ["read", extra, "write"]
var log: [String] = []
var total = 0

for task in tasks {
    log.append("run:\(task)")
    total += 1
}

let joined = log.joined(separator: ",")

print("extra=\(extra)")
print("log=\(joined)")
print("total=\(total)")
  1. extra ← audit, tasks ← ["read", "audit", "write"], log ← [], total ← 0

    1let extra→ audit = "audit"  //@extra="review", "ship"2var tasks→ ["read", "audit", "write"] = ["read", extraaudit, "write"]3var log→ []: [String] = []4var total→ 0 = 0
  2. log ← ["run:read"], total ← 1

    pass 1 of 3
    6for taskread in tasks["read", "audit", "write"] {7    log→ ["run:read"].append("run:\(taskread)")8    total→ 1 += 19}
    All 3 passes — pass 1 is the card above
    passtasklogtotal
    1read[] ["run:read"]0 1
    2audit["run:read"] ["run:read", "run:audit"]1 2
    3write["run:read", "run:audit"] ["run:read", "run:audit", "run:write"]2 3
  3. joined ← run:read,run:audit,run:write

    11let joined→ run:read,run:audit,run:write = log["run:read", "run:audit", "run:write"].joined(separator: ",")1213print("extra=\(extraaudit)")14print("log=\(joinedrun:read,run:audit,run:write)")15print("total=\(total3)")
    outputextra=audit
    log=run:read,run:audit,run:write
    total=3
  1. extra ← review, tasks ← ["read", "review", "write"], log ← []

    1let extra→ review = "review"2var tasks→ ["read", "review", "write"] = ["read", extrareview, "write"]3var log→ []: [String] = []4var total→ 0 = 0
  2. log ← ["run:read"], total ← 1

    pass 1 of 3
    6for taskread in tasks["read", "review", "write"] {7    log→ ["run:read"].append("run:\(taskread)")8    total→ 1 += 19}
    All 3 passes — pass 1 is the card above
    passtasklogtotal
    1read[] ["run:read"]0 1
    2review["run:read"] ["run:read", "run:review"]1 2
    3write["run:read", "run:review"] ["run:read", "run:review", "run:write"]2 3
  3. joined ← run:read,run:review,run:write

    11let joined→ run:read,run:review,run:write = log["run:read", "run:review", "run:write"].joined(separator: ",")1213print("extra=\(extrareview)")14print("log=\(joinedrun:read,run:review,run:write)")15print("total=\(total3)")
    outputextra=review
    log=run:read,run:review,run:write
    total=3
  1. extra ← ship, tasks ← ["read", "ship", "write"], log ← [], total ← 0

    1let extra→ ship = "ship"2var tasks→ ["read", "ship", "write"] = ["read", extraship, "write"]3var log→ []: [String] = []4var total→ 0 = 0
  2. log ← ["run:read"], total ← 1

    pass 1 of 3
    6for taskread in tasks["read", "ship", "write"] {7    log→ ["run:read"].append("run:\(taskread)")8    total→ 1 += 19}
    All 3 passes — pass 1 is the card above
    passtasklogtotal
    1read[] ["run:read"]0 1
    2ship["run:read"] ["run:read", "run:ship"]1 2
    3write["run:read", "run:ship"] ["run:read", "run:ship", "run:write"]2 3
  3. joined ← run:read,run:ship,run:write

    11let joined→ run:read,run:ship,run:write = log["run:read", "run:ship", "run:write"].joined(separator: ",")1213print("extra=\(extraship)")14print("log=\(joinedrun:read,run:ship,run:write)")15print("total=\(total3)")
    outputextra=ship
    log=run:read,run:ship,run:write
    total=3
queue panel A queue can be replayed as list updates and a bounded loop when the work items are fixed inputs.