From 34c1f416f4d5832763659d0f89d4442bb6b146a7 Mon Sep 17 00:00:00 2001 From: Elliot Glaysher Date: Wed, 13 May 2020 11:18:37 -0700 Subject: [PATCH] jets: +welp and +zing --- bin/solid.pill | 4 ++-- pkg/arvo/sys/hoon.hoon | 2 ++ pkg/urbit/include/jets/w.h | 2 ++ pkg/urbit/jets/b/zing.c | 44 ++++++++++++++++++++++++++++++++++++++ pkg/urbit/jets/tree.c | 6 ++++++ 5 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 pkg/urbit/jets/b/zing.c diff --git a/bin/solid.pill b/bin/solid.pill index e957ab79d..72209cb97 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bc9430cd9b988dbd594db4e5e69b2f16217eaccee54254d28a03eafcba9a0c4b -size 12863883 +oid sha256:0adaf644c2978ff78816762f68d7b517a845f4a6fb3d42d50e3c5574c6ebc53d +size 12863979 diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index d66874108..20a83cd72 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -778,6 +778,7 @@ (weld (scag b a) [c (slag b a)]) :: ++ welp :: faceless weld + ~/ %welp =| {* *} |@ ++ $ @@ -787,6 +788,7 @@ -- :: ++ zing :: promote + ~/ %zing =| * |@ ++ $ diff --git a/pkg/urbit/include/jets/w.h b/pkg/urbit/include/jets/w.h index 91cb66fed..33ea712aa 100644 --- a/pkg/urbit/include/jets/w.h +++ b/pkg/urbit/include/jets/w.h @@ -39,6 +39,8 @@ u3_noun u3wb_sort(u3_noun); u3_noun u3wb_turn(u3_noun); u3_noun u3wb_weld(u3_noun); +# define u3wb_welp u3wb_weld + u3_noun u3wb_zing(u3_noun); /** Tier 3. **/ diff --git a/pkg/urbit/jets/b/zing.c b/pkg/urbit/jets/b/zing.c new file mode 100644 index 000000000..20570b412 --- /dev/null +++ b/pkg/urbit/jets/b/zing.c @@ -0,0 +1,44 @@ +/* j/2/zing.c +** +*/ +#include "all.h" + + +/* functions +*/ +u3_noun +u3qb_zing(u3_noun a) +{ + u3_noun top = u3qb_flop(a); + u3_noun top_orig = top; + u3_noun l = 0; + + while ( u3_nul != top ) { + u3_noun f = u3qb_flop(u3h(top)); + u3_noun f_orig = f; + + while ( u3_nul != f ) { + l = u3nc(u3k(u3h(f)), l); + f = u3t(f); + } + + u3z(f_orig); + top = u3t(top); + } + + u3z(top_orig); + + return l; +} + +u3_noun +u3wb_zing(u3_noun cor) +{ + u3_noun a; + + if ( c3n == u3r_mean(cor, u3x_sam, &a, 0) ) { + return u3m_bail(c3__exit); + } else { + return u3qb_zing(a); + } +} diff --git a/pkg/urbit/jets/tree.c b/pkg/urbit/jets/tree.c index 1434e62c1..7b58f2e6f 100644 --- a/pkg/urbit/jets/tree.c +++ b/pkg/urbit/jets/tree.c @@ -1373,6 +1373,10 @@ static c3_c* _141_two_turn_ha[] = { "cd4a292788acd440d6ace689f82fa999b342bb749585bc0e173098529bb75fb8", 0 }; + +static u3j_harm _141_two_welp_a[] = {{".2", u3wb_welp, c3y}, {}}; +static u3j_harm _141_two_zing_a[] = {{".2", u3wb_zing, c3y}, {}}; + static u3j_harm _141_two_weld_a[] = {{".2", u3wb_weld, c3y}, {}}; static c3_c* _141_two_weld_ha[] = { "d855628821d57392f575c5da000c7326eaaa19e08cda967a4772859269669df2", @@ -1735,6 +1739,8 @@ static u3j_core _141_two_d[] = { "sort", 7, _141_two_sort_a, 0, _141_two_sort_ha }, { "turn", 7, _141_two_turn_a, 0, _141_two_turn_ha }, { "weld", 7, _141_two_weld_a, 0, _141_two_weld_ha }, + { "welp", 7, _141_two_welp_a }, + { "zing", 7, _141_two_zing_a }, { "bex", 7, _141_two_bex_a, 0, _141_two_bex_ha }, { "cat", 7, _141_two_cat_a, 0, _141_two_cat_ha },