def ascend_loop

bend-collections@1.0.0.0 · src/containers/balanced_search_tree.bend:1123

import bend-collections@1.0.0.0/src/containers/balanced_search_tree.bend as BalancedSearchTree
import Base

1123def ascend_loop(~K: Data, ~V: Data, ~cmp: K -> K -> Cmp, +fuel: Nat, +forward: Bool, st: TreeMap<K, V, cmp> & Ascend) -> TreeMap<K, V, cmp> & Nat:
1124  match fuel st:
1125    case 0n Tuple{m, state}:
1126      (m, 0n)
1127    case 1n+f Tuple{m, Ascend{x, p, True{}}}:
1128      (m, p)
1129    case 1n+f Tuple{m, Ascend{+x, +p, False{}}}:
1130      ascend_loop(~K, ~V, ~cmp, f, forward, ascend_step_node(~K, ~V, ~cmp, x, p, forward, read(~K, ~V, ~cmp, m, p)))

Uses (9)

Used by (0)

No other definition uses this definition.