def find
import near-v-framework@0.4.0.0/general/rose/ops.bend as Opsimport Base
import near-v-framework@0.4.0.0/general/rose/type.bend as R
47# The value at a key, if the forest has it.
48def find(-N: Data, +k: String, rs: List<&2, R.Rose<N>>) -> Maybe<&2, N>:
49 match rs:
50 case []:
51 None{}
52 case r <> rest:
53 match r:
54 case R.Rose{rk, v, kids}:
55 found(N, String.eq(k, rk), v, find(N, k, kids), find(N, k, rest))