Skip to main content

≡ — Depth / Match

Function. Keys: Alt-=. Hanzi: 同/深. Ranks: ∞ monadic, ∞ ∞ dyadic

≡Y gives nesting depth: 0 for an atom, and otherwise 1 more than the deepest item. An empty array takes the depth of its prototype.

≡1 2 3             ⍝ 1ₓ
≡[1 [2 3]]         ⍝ 2ₓ
≡5                 ⍝ 0ₓ

X≡Y tests equal shape and corresponding contents, using tolerant numeric equality. NaN matches NaN. The result is one Boolean. = compares item by item instead.

1 2≡1 2            ⍝ $t
1≡,1               ⍝ $f

Axes match as arithmetic pairs them. An axis matches another with the same name, or one with no name, but never one with a different name. When both axes have keys, they must hold the same keys in any order, and items compare by key. An axis without keys matches any keys. Search functions such as ⍳ match cells by the same rule.

⍳["i":3] ≡ ⍳3ₓ                  ⍝ $t
⍳["i":3] ≡ ⍳["j":3]            ⍝ $f
•index3 ≡ •index3            ⍝ $f
["a":1 "b":2]≡["b":2 "a":1]    ⍝ $t
["a":1 "b":2]≡1 2              ⍝ $t