jets: +welp and +zing

This commit is contained in:
Elliot Glaysher 2020-05-13 11:18:37 -07:00
parent 8602ed8aa5
commit 34c1f416f4
5 changed files with 56 additions and 2 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bc9430cd9b988dbd594db4e5e69b2f16217eaccee54254d28a03eafcba9a0c4b
size 12863883
oid sha256:0adaf644c2978ff78816762f68d7b517a845f4a6fb3d42d50e3c5574c6ebc53d
size 12863979

View File

@ -778,6 +778,7 @@
(weld (scag b a) [c (slag b a)])
::
++ welp :: faceless weld
~/ %welp
=| {* *}
|@
++ $
@ -787,6 +788,7 @@
--
::
++ zing :: promote
~/ %zing
=| *
|@
++ $

View File

@ -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.
**/

44
pkg/urbit/jets/b/zing.c Normal file
View File

@ -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);
}
}

View File

@ -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 },