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