Mercurial > hg > Papers > 2023 > soto-master
view Paper/src/bt_impl/find.agda @ 1:a72446879486
Init paper
author | soto <soto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 12 Jan 2023 20:28:50 +0900 |
parents | |
children |
line wrap: on
line source
find : {n m : Level} {A : Set n} {t : Set m} → (env : Env A ) → (next : (env : Env A ) → t ) → (exit : (env : Env A ) → t ) → t find env next exit = find-c (vart env) env next exit where find-c : {n m : Level} {A : Set n} {t : Set m} → (tree : bt A) → (env : Env A ) → (next : (env : Env A ) → t ) → (exit : (env : Env A ) → t ) → t find-c leaf env next exit = exit env find-c n@(node key-t value ltree rtree) env next exit with <-cmp (varn env) key-t ... | tri< a ¬b ¬c = find-c ltree record env {vart = ltree ; varl = (n ∷ (varl env))} next exit ... | tri≈ ¬a b ¬c = exit record env {vart = n} ... | tri> ¬a ¬b c = find-c rtree record env {vart = rtree ; varl = (n ∷ (varl env))} next exit