def collect_extend

bend-prot@0.1.0.0 · pdb.bend:331

import bend-prot@0.1.0.0/pdb.bend as Pdb
import Base
import bend-prot@0.1.0.0/protein.bend as P

331# Collect parsed atoms plus the skipped-line count. Tail-recursive: the
332# extend step builds both outcomes as data (no match, no cycle) and the
333# single self-call runs on the tail.
334def collect_extend(m: Maybe<&1, U32 & Nat & P.Atom>, st: List<&1, U32 & Nat & P.Atom> & Nat) -> List<&1, U32 & Nat & P.Atom> & Nat:
335  match m:
336    case None{}:
337      match st:
338        case (as, n):
339          (as, 1n+n)
340    case Some{x}:
341      match st:
342        case (as, n):
343          (x <> as, n)

Uses (7)

Used by (1)