def field_seek
import cli@0.2.0.0/cli.bend as Cliimport Base
4548# The field for id, or an absent one; after a hit it walks no further.
4549def field_seek(fields: List<&2, Field>, +id: String,
4550 found: Maybe<&2, Field>) -> Field:
4551 match fields found:
4552 case _ Some{f}: f
4553 case Nil{} None{}: Field{id, [], Absent{}}
4554 case f <> tail None{}: field_seek(tail, id, field_found(f, id))