def nav_fast
bend-collections@1.0.0.0 · src/containers/balanced_search_tree.bend:1019
import bend-collections@1.0.0.0/src/containers/balanced_search_tree.bend as BalancedSearchTree
import Base
1019def nav_fast(~K: Data, ~V: Data, ~cmp: K -> K -> Cmp, +fuel: Nat, +k: K, +higher: Bool, +best: Nat, st: NodeStore<K> & (Nat & Maybe<&2, Cmp>)) -> NodeStore<K> & NavEnd:
1020 match fuel st:
1021 case 0n Tuple{nodes, x}:
1022 (nodes, NavBest{best})
1023 case 1n+f Tuple{nodes, Tuple{id, None{}}}:
1024 (nodes, NavBest{best})
1025 case 1n+f Tuple{nodes, Tuple{+id, Some{LT{}}}}:
1026 nav_fast(~K, ~V, ~cmp, f, k, higher, pick(Nat, higher, id, best), search_down(~K, ~V, ~cmp, nodes, id, True{}, k))
1027 case 1n+f Tuple{nodes, Tuple{+id, Some{GT{}}}}:
1028 nav_fast(~K, ~V, ~cmp, f, k, higher, pick(Nat, higher, best, id), search_down(~K, ~V, ~cmp, nodes, id, False{}, k))
1029 case 1n+f Tuple{nodes, Tuple{+id, Some{EQ{}}}}:
1030 (nodes, NavEqual{id})