Mercurial > hg > Papers > 2023 > soto-master
view Paper/src/bt_impl/replace.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
replace : {n m : Level} {A : Set n} {t : Set m} → (env : Env A ) → (next : Env A → t ) → (exit : Env A → t) → t replace env next exit = replace-c (varl env) env next exit where replace-c : {n m : Level} {A : Set n} {t : Set m} → List (bt A) → (env : Env A ) → (next : Env A → t ) → (exit : Env A → t) → t replace-c st env next exit with st ... | [] = exit env ... | leaf ∷ st1 = replace-c st1 env next exit ... | n@(node key-t value ltree rtree) ∷ st1 with <-cmp (varn env) (key-t) ... | tri< a ¬b ¬c = replace-c st1 record env{vart = (node key-t value (vart env) rtree); varl = st1} next exit ... | tri≈ ¬a b ¬c = replace-c st1 record env{vart = (node key-t (varv env) ltree rtree); varl = st1} next exit ... | tri> ¬a ¬b c = replace-c st1 record env{vart = (node key-t value ltree (vart env)); varl = st1} next exit