Merge

Multiple signals converge into one point. The merge operator | is how Z+ handles signal combination. Like a musical chord — the notes ring together. The harmony IS the decision.

Basic Merge

.zpbasic merge
// three signals converge
sonar  -> |
camera -> | -> decision
lidar  -> |

Merge Policies

The merge point has a policy that determines when and how it resolves.

all (Chord)

Wait for every signal. Resolves as one simultaneous moment. No time-of-check vs time-of-use because there is no gap between the checks.

.zpall policy
// strict chord — all signals must arrive
a -> |
b -> | all | -> output
c -> |

any (First Wins)

First signal to arrive triggers resolution.

.zpany policy
// any — first signal wins
a -> | any | -> output

Quorum

Resolve when a minimum count of signals arrive. Like distributed consensus, but in wiring. In distributed systems, this is Raft or Paxos — thousands of lines. In Z+, it's 2 of 3.

.zpquorum
// quorum — 2 of 3 signals required
a -> |
b -> | 2 of 3 | -> output
c -> |

Sorted Merge

.zpsorted merge
// order book — sort by price then time
bids -> | merge(sort: price descending, then: time ascending) | -> book

Confluence (Temporal Merge)

Signals that arrive within a time window are treated as coincident. Boolean AND asks "are both true right now?" Confluence asks "have both spoken recently?" Two sensors might never fire at the exact same nanosecond. Confluence handles this.

.zpconfluence
// temporal — signals within a time window
a -> |
b -> | within(100ms) | -> fused
c -> |

// ordered temporal — A then B
badge  -> |
door   -> | then, within(30s) | -> normal_entry

// reverse order = different meaning
door   -> |
badge  -> | then, within(30s) | -> unexpected_entry
// same events, different temporal order, different signal

Resonance

Independent signal chains converging on the same conclusion. Resonance is different from a chord — a chord waits for signals to arrive. Resonance asks whether independent chains converge on the same conclusion. It's convergent evidence.

.zpresonance
// one anomaly is noise. two are suspicious. three are certain.
network_anomaly  -> |
file_tampering   -> | resonance(2 of 3, within: 10s) | -> probable
process_spawn    -> |

network_anomaly  -> |
file_tampering   -> | resonance(3 of 3, within: 10s) | -> confirmed
process_spawn    -> |

No rule engine. No correlation database. Just wiring that says "if these three independent observations agree within this window, that means something."

Chords

In sequential code, you check conditions one at a time. The values might change between checks. In Z+, signals arrive together and resolve as a chord — atomically. No locks, no mutexes. Three arrows and a pipe.

.zpchords
// chord — resolves atomically
sonar.clear  -> |
camera.safe  -> | -> proceed -> motors
battery.ok   -> |

// partial chord with quorum
a -> |
b -> | 2 of 3 | -> output
c -> |

// fastest N, ignore stragglers
a -> |
b -> | fastest(2) | -> output
c -> |