def taken
bend-lint-rules@0.2.0.0 · language/decreasing_call.bend:86
import bend-lint-rules@0.2.0.0/language/decreasing_call.bend as DecreasingCall
import Base
import bend-lint-api@0.2.0.0/linter/lint.bend as Lint
import bend-lint-api@0.2.0.0/shared/lists.bend as Lists
86
87
88def taken(
89 scrutinees: List<&2, Lint.Node>,
90 patterns: List<&2, Lint.Node>,
91 +smaller: List<&2, Smaller>
92) -> List<&2, Smaller>:
93 match scrutinees patterns:
94 case Con{
95 Lint.Node{Lint.Variable{s}, n, sp, k, f},
96 more
97 } Con{Lint.Node{Lint.PatternConstructor{t}, pn, ps, kids, pf}, rest}:
98 taken(
99 more,
100 rest,
101 Lists.onto(
102 &2,
103 Smaller,
104 pairs(roots(smaller, s, []), Lint.Node.bound(kids, []), []),
105 smaller
106 )
107 )
108 case Con{x, more} Con{y, rest}:
109 taken(more, rest, smaller)
110 case _ _:
111 smaller