def find.go
import bolt@1.27.0.0/src/syntax/bind.bend as Bindimport Base
186# the innermost binder of a name in an environment; hit: the binder before
187# env was the name, so the search stops there
188def find.go(env: List<&2, Bind>, +name: String, hit: Maybe<&2, Bind>) -> Maybe<&2, Bind>:
189 match env:
190 case Nil{}:
191 hit
192 case Con{Bind{+n, l, c, k, note}, t}:
193 match hit:
194 case Some{x}:
195 Some{x}
196 case None{}:
197 find.go(t, name, Bool.pick(Maybe<&2, Bind>, String.eq(n, name), Some{Bind{n, l, c, k, note}}, None{}))