diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 43dc11b615..b259b1ed04 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -1619,6 +1619,7 @@ [-.f a(l +.e, r +.f)] :: ++ run :: apply gate to values + ~/ %run |* b/gate |- ?~ a a diff --git a/pkg/urbit/include/jets/w.h b/pkg/urbit/include/jets/w.h index 98d8e07db3..c63026a192 100644 --- a/pkg/urbit/include/jets/w.h +++ b/pkg/urbit/include/jets/w.h @@ -89,6 +89,7 @@ u3_noun u3wdb_put(u3_noun); # define u3wdb_tap u3wdi_tap u3_noun u3wdb_uni(u3_noun); + u3_noun u3wdb_run(u3_noun); u3_noun u3wdi_bif(u3_noun); u3_noun u3wdi_del(u3_noun); diff --git a/pkg/urbit/jets/d/by_run.c b/pkg/urbit/jets/d/by_run.c new file mode 100644 index 0000000000..6fd2d2cf87 --- /dev/null +++ b/pkg/urbit/jets/d/by_run.c @@ -0,0 +1,38 @@ +/* j/4/by_run.c +** +*/ +#include "all.h" + +/* internal functions + */ +static u3_noun +_by_run(u3_noun a, u3j_site* sit_u) +{ + if (u3_nul == a) { + return 0; + } else { + u3_noun n_a, l_a, r_a; + u3_noun p_n_a, q_n_a; + u3x_trel(a, &n_a, &l_a, &r_a); + u3x_cell(n_a, &p_n_a, &q_n_a); + + u3_noun nu_q_n_a = u3j_gate_slam(sit_u, u3k(q_n_a)); + u3_noun nu_l = _by_run(l_a, sit_u); + u3_noun nu_r = _by_run(r_a, sit_u); + return u3nt(u3nc(u3k(p_n_a), nu_q_n_a), nu_l, nu_r); + } +} + +u3_noun +u3wdb_run(u3_noun cor) +{ + u3_noun a, b; + u3j_site sit_u; + + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + + u3j_gate_prep(&sit_u, u3k(b)); + u3_noun pro = _by_run(a, &sit_u); + u3j_gate_lose(&sit_u); + return pro; +} diff --git a/pkg/urbit/jets/tree.c b/pkg/urbit/jets/tree.c index 43c266a960..283fae8191 100644 --- a/pkg/urbit/jets/tree.c +++ b/pkg/urbit/jets/tree.c @@ -1635,6 +1635,9 @@ static c3_c* _141_two__in_ha[] = { "2cc9f005fde5314e9ad545286493a8c81b5c3b775d645ad82954f405d9414a32", 0 }; + + static u3j_harm _141_two__by_run_a[] = {{".2", u3wdb_run, c3y}, {}}; + static u3j_harm _141_two__by_tap_a[] = {{".2", u3wdb_tap, c3y}, {}}; static c3_c* _141_two__by_tap_ha[] = { "7dde59e2bd7684e785ce9787bc394571bd1216d7a62398c703447fc951c6b352", @@ -1655,6 +1658,7 @@ static u3j_core _141_two__by_d[] = // { "int", 7, _141_two__by_int_a, 0, _141_two__by_int_ha }, { "jab", 7, _141_two__by_jab_a, 0, _141_two__by_jab_ha }, { "put", 7, _141_two__by_put_a, 0, _141_two__by_put_ha }, + { "run", 7, _141_two__by_run_a }, { "tap", 7, _141_two__by_tap_a, 0, _141_two__by_tap_ha }, // { "uni", 7, _141_two__by_uni_a, 0, _141_two__by_uni_ha }, {}