def nav_loop
import bend-collections@1.0.0.0/src/containers/balanced_search_tree.bend as BalancedSearchTreeimport Base
1249def nav_loop(~K: Data, ~V: Data, ~cmp: K -> K -> Cmp, +fuel: Nat, +k: K, +higher: Bool, +inclusive: Bool, +id: Nat, +best: Nat, st: TreeMap<K, V, cmp> & (Node<K> & Cmp)) -> TreeMap<K, V, cmp> & Nat:
1250 match fuel st:
1251 case 0n Tuple{m, node}:
1252 (m, best)
1253 case 1n+f Tuple{m, Tuple{Free{next}, order}}:
1254 (m, best)
1255 case 1n+f Tuple{m, Tuple{N{c, +l, r, p, key}, LT{}}}:
1256 nav_loop(~K, ~V, ~cmp, f, k, higher, inclusive, l, pick(Nat, higher, id, best), probe(~K, ~V, ~cmp, m, l, k))
1257 case 1n+f Tuple{m, Tuple{N{c, l, +r, p, key}, GT{}}}:
1258 nav_loop(~K, ~V, ~cmp, f, k, higher, inclusive, r, pick(Nat, higher, best, id), probe(~K, ~V, ~cmp, m, r, k))
1259 case 1n+f Tuple{m, Tuple{node, EQ{}}}:
1260 nav_equal(~K, ~V, ~cmp, m, id, higher, inclusive)
Uses (10)
Used by (0)
No other definition uses this definition.