u3: refactors +urn:by jet, normalizing declarations

This commit is contained in:
Joe Bryan 2020-10-13 23:55:05 -07:00
parent 2832307c5d
commit 6fa50ff69f
2 changed files with 21 additions and 17 deletions

View File

@ -86,6 +86,7 @@
u3_noun u3qdb_run(u3_noun, u3_noun);
# define u3qdb_tap u3qdi_tap
u3_noun u3qdb_uni(u3_noun, u3_noun);
u3_noun u3qdb_urn(u3_noun, u3_noun);
u3_noun u3qdi_apt(u3_noun);
u3_noun u3qdi_bif(u3_noun, u3_noun);

View File

@ -3,36 +3,39 @@
*/
#include "all.h"
/* internal functions
*/
static
u3_noun
static u3_noun
_by_urn(u3_noun a, u3j_site* sit_u)
{
if (u3_nul == a) {
return 0;
} else {
if ( u3_nul == a ) {
return u3_nul;
}
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);
return u3nt(u3nc(u3k(p_n_a), u3j_gate_slam(sit_u, u3k(n_a))),
return u3nt(u3nc(u3k(u3h(n_a)), u3j_gate_slam(sit_u, u3k(n_a))),
_by_urn(l_a, sit_u),
_by_urn(r_a, sit_u));
}
}
u3_noun
u3qdb_urn(u3_noun a, u3_noun b)
{
u3_noun pro;
u3j_site sit_u;
u3j_gate_prep(&sit_u, u3k(b));
pro = _by_urn(a, &sit_u);
u3j_gate_lose(&sit_u);
return pro;
}
u3_noun
u3wdb_urn(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_urn(a, &sit_u);
u3j_gate_lose(&sit_u);
return pro;
return u3qdb_urn(a, b);
}