Mercurial > hg > Papers > 2023 > soto-master
view Paper/src/bt_impl/find.agda @ 32:4915eaa51ee0 default tip
Add front
author | soto <soto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 23 Feb 2023 18:39:56 +0900 |
parents | a72446879486 |
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