def len.go

emerging-ezjson@1.3.0.0 · src/value.bend:412

import emerging-ezjson@1.3.0.0/src/value.bend as Value
import Base

412# how many cells a chain of array or object cells holds
413def len.go(cells: Json) -> Nat:
414  match cells:
415    case JCons{_, tl}:
416      1n+len.go(tl)
417    case JPair{_, _, rr}:
418      1n+len.go(rr)
419    case JBind{_, _, _, rr}:
420      1n+len.go(rr)
421    case _:
422      0n

Uses (2)

Used by (1)