def search_fast
bend-collections@1.0.0.0 · src/containers/balanced_search_tree.bend:973
import bend-collections@1.0.0.0/src/containers/balanced_search_tree.bend as BalancedSearchTree
import Base
973def search_fast(~K: Data, ~V: Data, ~cmp: K -> K -> Cmp, +fuel: Nat, +k: K, +p: Nat, +on_left: Bool, st: NodeStore<K> & (Nat & Maybe<&2, Cmp>)) -> NodeStore<K> & Search:
974 match fuel st:
975 case 0n Tuple{nodes, x}:
976 (nodes, Search{0n, p, on_left})
977 case 1n+f Tuple{nodes, Tuple{id, None{}}}:
978 (nodes, Search{0n, p, on_left})
979 case 1n+f Tuple{nodes, Tuple{+id, Some{LT{}}}}:
980 search_fast(~K, ~V, ~cmp, f, k, id, True{}, search_down(~K, ~V, ~cmp, nodes, id, True{}, k))
981 case 1n+f Tuple{nodes, Tuple{+id, Some{GT{}}}}:
982 search_fast(~K, ~V, ~cmp, f, k, id, False{}, search_down(~K, ~V, ~cmp, nodes, id, False{}, k))
983 case 1n+f Tuple{nodes, Tuple{+id, Some{EQ{}}}}:
984 (nodes, Search{id, p, on_left})