Chaining Rules Cheat-Sheet

If you don't know what chaining rules are, it may help to revisit the beginners' page. Essentially, if multiple chains are written sequentially (whether they be outer chains within a link or inner chains within outer chains), Jelly matches specific patterns based on their arities and walks down the chain, evaluating based on the pattern. You can think of it as there being an accumulating value that changes as the interpreter processes the chain.

If a nilad appears without being part of a valid pattern, it will output the current value to STDOUT (without a trailing newline) and set the current value to the nilad's result (this is known as "smash-printing" because multiple nilads placed together will smash their values to STDOUT with no separator).

The left argument will be α and the right argument will be ω. The current value will be λ. Nilads will be represented by digits, monads by capital letters, and dyads by mathematical operations like + × ÷.

Leading Constant Chains

A leading constant chain (LCC) is a special type of chain that starts with a nilad and is followed by monads, dyad-nilad pairs, and nilad-dyad pairs. Essentially, the nilad must not be paired with a dyad immediately after it. You can think of it as a chain that takes no arguments (i.e. is niladic) because it begins with a nilad itself and then follows it with a chain of monadic-like operations. Certain chaining rules depend on this.

Niladic Chains

Note that this means an empty chain will just evaluate to 0.

Monadic Chains
Pattern New λ value Arities / Name
+ F ... λ + F(α) 2,1-chain
+ 1 ... λ + 1 2,0-chain / dyad-nilad pair
1 + ... 1 + λ 0,2-chain / nilad-dyad pair
+ λ + α Lone Dyad
F F(λ) Lone Monad
Dyadic Chains
Pattern New λ value Arities / Name
+ × 1 ... (λ + ω) × 1* 2,2,0-chain
+ × λ + (α × ω) 2,2-chain
+ 1 ... λ + 1 2,0-chain / dyad-nilad pair
1 + ... 1 + λ 0,2-chain / nilad-dyad pair
+ λ + ω Lone Dyad
F F(λ) Lone Monad

* The 2,2,0-chain rule only applies if the nilad is part of an LCC; that is, the nilad is not followed by a dyad.