⍣ — Iterate / Invert / Historyf⍣N Y applies f N times. N=0 returns Y. In dyadic calls the left argument stays fixed.
(2∘×⍣3)1 ⍝ 8
2(+⍣3)1 ⍝ 7
Negative counts apply the known inverse.
(2∘×⍣¯1)10 ⍝ 5
10(-\⍣¯1)9 7 4 ⍝ 1 2 3
Inverses propagate through composition, binding, Each, rank, dyadic commute/Behind and scans. Primitive inverses include arithmetic bindings, exp/log, circle, axis permutations, encode/decode, enclosure/mix/split and Where. Square roots and logs select branches.
f⍣g Y iterates until new g old is true, returning new.
1(+⍣{⍺>4})0 ⍝ 5
Array counts give that frame of result cells, assembled with fill.
(1∘+)⍣3 ¯2 0 3⊢10 ⍝ 13 8 10 13
⍴({1÷0}⍣(0 2⍴0))'ab' ⍝ 0x 2x 2x
Positive steps run first, then inverse steps from Y; repeated counts reuse states. Empty counts use Y’s cell shape/fill directly.
Enclose the count to collect states 0…N, including Y. Negative N steps through the inverse; dyadic calls hold X fixed.
(1∘+)⍣[3]⊢5 ⍝ 5 6 7 8
(1∘+)⍣[¯2]⊢5 ⍝ 5 4 3
{1÷0}⍣[0]⊢'ab' ⍝ 1 2⍴'ab'
Enclose a predicate to collect states until new g old is true. Includes initial and terminating states; always takes at least one step.
1(+⍣[{⍺=3}])0 ⍝ 0 1 2 3
⊢⍣[≡]⊢4 ⍝ 4 4
States assemble with fill.
{⍵,1}⍣[2]⊢,2 ⍝ 3 3⍴2 0 0 2 1 0 2 1 1
n←{0.5×⍵+2÷⍵} ⋄ ≢n⍣[≡]⊢1 ⍝ 7x
See Inverse pair. Convergence: f⍣≡; convergence history: f⍣[≡].
RANK: history count is not an atom. DOMAIN: non-integral count, non-Boolean predicate, unknown inverse.