Revert "adds pristine jet copies (hash-order, containers, compiler)"

This reverts commit a906af1ca4.
This commit is contained in:
Joe Bryan 2019-01-07 23:35:06 -05:00
parent 658a77f88b
commit 4e9c237b61
42 changed files with 0 additions and 7429 deletions

View File

@ -1,32 +0,0 @@
/* j/3/gor.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qc_gor(u3_noun a,
u3_noun b)
{
c3_w c_w = u3r_mug(a);
c3_w d_w = u3r_mug(b);
if ( c_w == d_w ) {
return u3qc_dor(a, b);
}
else return (c_w < d_w) ? c3y : c3n;
}
u3_noun
u3wc_gor(u3_noun cor)
{
u3_noun a, b;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) ) {
return u3m_bail(c3__exit);
} else {
return u3qc_gor(a, b);
}
}

View File

@ -1,31 +0,0 @@
/* j/3/vor.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qc_vor(u3_atom a,
u3_atom b)
{
c3_w c_w = u3r_mug(u3r_mug(a));
c3_w d_w = u3r_mug(u3r_mug(b));
if ( c_w == d_w ) {
return u3qc_dor(a, b);
}
else return (c_w < d_w) ? c3y : c3n;
}
u3_noun
u3wc_vor(u3_noun cor)
{
u3_noun a, b;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) ) {
return u3m_bail(c3__exit);
} else {
return u3qc_vor(a, b);
}
}

View File

@ -1,82 +0,0 @@
/* jets/d/by_bif.c
**
*/
#include "all.h"
/* internal functions
*/
static
u3_noun _b_bif_putroot(u3_noun a,
u3_noun b)
{
if ( u3_nul == a) {
return u3nt(u3k(b), u3_nul, u3_nul);
}
else {
u3_noun n_a, l_a, r_a;
u3_noun p_n_a, q_n_a;
u3_noun p_b, q_b;
if ( (c3n == u3r_trel(a, &n_a, &l_a, &r_a))
|| (c3n == u3r_cell(b, &p_b, &q_b))
|| (c3n == u3r_cell(n_a, &p_n_a, &q_n_a)) ) {
return u3m_bail(c3__exit);
}
else if ( c3y == u3r_sing(p_b, p_n_a) ) {
return u3nt(u3k(b), u3k(l_a), u3k(r_a));
}
else {
u3_noun c, n_c, l_c, r_c;
u3_noun d;
if ( c3y == u3qc_gor(p_b, p_n_a) ) {
c = _b_bif_putroot(l_a, b);
u3r_trel(c, &n_c, &l_c, &r_c);
d = u3nt(u3k(n_c),
u3k(l_c),
u3nt(u3k(n_a), u3k(r_c), u3k(r_a))
);
u3z(c);
return d;
} else {
c = _b_bif_putroot(r_a, b);
u3r_trel(c, &n_c, &l_c, &r_c);
d = u3nt(u3k(n_c),
u3nt(u3k(n_a), u3k(l_a), u3k(l_c)),
u3k(r_c)
);
u3z(c);
return d;
}
}
}
}
/* functions
*/
u3_noun u3wdb_bif(u3_noun cor)
{
u3_noun a, b;
if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) ) {
return u3m_bail(c3__exit);
} else {
return u3qdb_bif(a, b);
}
}
u3_noun u3qdb_bif(u3_noun a,
u3_noun b)
{
u3_noun c, n_c, l_c, r_c;
u3_noun d;
c = _b_bif_putroot(a, b);
u3r_trel(c, &n_c, &l_c, &r_c);
d = u3nc(u3k(l_c), u3k(r_c));
u3z(c);
return d;
}
/*
u3_weak u3kdi_bif(u3_noun a, u3_noun b);
*/

View File

@ -1,111 +0,0 @@
/* j/4/by_del.c
**
*/
#include "all.h"
/* functions
*/
static u3_noun
_rebalance(u3_noun a)
{
u3_noun l_a, n_a, r_a;
if ( c3n == u3r_trel(a, &n_a, &l_a, &r_a) ) {
return u3m_bail(c3__exit);
}
else {
if ( u3_nul == l_a) {
return u3k(r_a);
}
else if ( u3_nul == r_a) {
return u3k(l_a);
}
else {
u3_noun n_l_a, l_l_a, r_l_a;
u3_noun n_r_a, l_r_a, r_r_a;
if ( (c3n == u3r_trel(l_a, &n_l_a, &l_l_a, &r_l_a) ) ||
(c3n == u3r_trel(r_a, &n_r_a, &l_r_a, &r_r_a) ) ||
(c3n == u3du(n_l_a)) ||
(c3n == u3du(n_r_a)) ) {
return u3m_bail(c3__exit);
}
else {
if ( c3y == u3qc_vor(u3h(n_l_a), u3h(n_r_a)) ) {
u3_noun new_right = u3nt(u3k(n_a),
u3k(r_l_a),
u3k(r_a));
u3_noun ret = u3nt(u3k(n_l_a),
u3k(l_l_a),
_rebalance(new_right));
u3z(new_right);
return ret;
}
else {
u3_noun new_left = u3nt(u3k(n_a),
u3k(l_a),
u3k(l_r_a));
u3_noun ret = u3nt(u3k(n_r_a),
_rebalance(new_left),
u3k(r_r_a));
u3z(new_left);
return ret;
}
}
}
}
}
u3_noun
u3qdb_del(u3_noun a,
u3_noun b)
{
if ( u3_nul == a ) {
return u3_nul;
}
else {
u3_noun l_a, n_a, r_a, pn_a, qn_a;
if ( (c3n == u3r_trel(a, &n_a, &l_a, &r_a)) ||
(c3n == u3r_cell(n_a, &pn_a, &qn_a)) )
{
return u3m_bail(c3__exit);
}
else if ( c3n == u3r_sing(pn_a, b) ) {
if ( c3y == u3qc_gor(b, pn_a) ) {
return u3nt(u3k(n_a),
u3qdb_del(l_a, b),
u3k(r_a));
}
else {
return u3nt(u3k(n_a),
u3k(l_a),
u3qdb_del(r_a, b));
}
}
else {
return _rebalance(a);
}
}
}
u3_noun
u3wdb_del(u3_noun cor)
{
u3_noun a, b;
if ( c3n == u3r_mean(cor, u3x_sam, &b,
u3x_con_sam, &a, 0) ) {
return u3m_bail(c3__exit);
}
else {
u3_noun n = u3qdb_del(a, b);
return n;
}
}

View File

@ -1,86 +0,0 @@
/* jets/d/by_dif.c
**
*/
#include "all.h"
/* internal functions
*/
static
u3_noun _b_dif_join(u3_noun d,
u3_noun e)
{
if ( u3_nul == d ) {
return u3k(e);
} else if (u3_nul == e) {
return u3k(d);
} else {
u3_noun n_d, l_d, r_d;
u3_noun n_e, l_e, r_e;
u3_noun p_n_d, q_n_d;
u3_noun p_n_e, q_n_e;
if ( c3n == u3r_trel(d, &n_d, &l_d, &r_d)
|| c3n == u3r_trel(e, &n_e, &l_e, &r_e)
|| c3n == u3r_cell(n_d, &p_n_d, &q_n_d)
|| c3n == u3r_cell(n_e, &p_n_e, &q_n_e) ) {
return u3m_bail(c3__exit);
} else {
if ( c3y == u3qc_vor(p_n_d, p_n_e) ) {
return u3nt(u3k(n_d),
u3k(l_d),
_b_dif_join(u3k(r_d), u3k(e)));
} else {
return u3nt(u3k(n_e),
_b_dif_join(u3k(d), u3k(l_e)),
u3k(r_e));
}
}
}
}
/* functions
*/
u3_noun u3wdb_dif(u3_noun cor)
{
u3_noun a, b;
if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) ) {
return u3m_bail(c3__exit);
} else {
return u3qdb_dif(a, b);
}
}
u3_noun u3qdb_dif(u3_noun a,
u3_noun b)
{
if ( u3_nul == b ) {
return u3k(a);
} else {
u3_noun n_b, l_b, r_b;
u3_noun c, l_c, r_c;
if ( c3n == u3r_trel(b, &n_b, &l_b, &r_b) ) {
return u3m_bail(c3__exit);
} else {
c = u3qdb_bif(a, n_b);
if ( c3n == u3r_cell(c, &l_c, &r_c) ) {
return u3m_bail(c3__exit);
} else {
u3_noun d;
u3_noun e;
d = u3qdb_dif(l_c, l_b);
e = u3qdb_dif(r_c, r_b);
u3z(c);
return _b_dif_join(d, e);
}
}
}
}
/*
u3_weak u3kdb_dif(u3_noun a, u3_noun b);
*/

View File

@ -1,65 +0,0 @@
/* j/4/gas.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qdb_gas(u3_noun a,
u3_noun b)
{
if ( u3_nul == b ) {
return u3k(a);
}
else {
if ( c3n == u3du(b) ) {
return u3m_bail(c3__exit);
} else {
u3_noun i_b = u3h(b);
u3_noun t_b = u3t(b);
if ( c3n == u3du(i_b) ) {
return u3m_bail(c3__exit);
} else {
u3_noun pi_b = u3h(i_b);
u3_noun qi_b = u3t(i_b);
u3_noun c;
if ( u3_none == (c = u3qdb_put(a, pi_b, qi_b)) ) {
return u3m_bail(c3__exit);
} else {
u3_noun d = u3qdb_gas(c, t_b);
u3z(c);
return d;
}
}
}
}
}
u3_noun
u3wdb_gas(u3_noun cor)
{
u3_noun a, b;
if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) ) {
return u3m_bail(c3__exit);
} else {
return u3qdb_gas(a, b);
}
}
u3_noun
u3kdb_gas(u3_noun a,
u3_noun b)
{
u3_weak c = u3qdb_gas(a, b);
u3z(a); u3z(b);
if ( u3_none == c ) {
return u3m_bail(c3__exit);
}
else return c;
}

View File

@ -1,77 +0,0 @@
/* j/4/by_get.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qdb_get(u3_noun a,
u3_noun b)
{
if ( u3_nul == a ) {
return u3_nul;
}
else {
u3_noun l_a, n_a, r_a;
u3_noun pn_a, qn_a;
if ( (c3n == u3r_trel(a, &n_a, &l_a, &r_a)) ||
(c3n == u3r_cell(n_a, &pn_a, &qn_a) ) )
{
return u3m_bail(c3__exit);
}
else {
if ( (c3y == u3r_sing(b, pn_a)) ) {
return u3nc(u3_nul, u3k(qn_a));
}
else {
if ( c3y == u3qc_gor(b, pn_a) ) {
return u3qdb_get(l_a, b);
}
else return u3qdb_get(r_a, b);
}
}
}
}
u3_noun
u3wdb_get(u3_noun cor)
{
u3_noun a, b;
if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) ) {
return u3m_bail(c3__exit);
} else {
return u3qdb_get(a, b);
}
}
u3_weak
u3kdb_get(u3_noun a,
u3_noun b)
{
u3_noun c = u3qdb_get(a, b);
u3z(a); u3z(b);
if ( c3n == u3r_du(c) ) {
u3z(c);
return u3_none;
} else {
u3_noun pro = u3k(u3t(c));
u3z(c);
return pro;
}
}
u3_noun
u3kdb_got(u3_noun a,
u3_noun b)
{
u3_weak c = u3kdb_get(a, b);
if ( u3_none == c ) {
return u3m_bail(c3__exit);
}
else return c;
}

View File

@ -1,61 +0,0 @@
/* j/4/by_has.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qdb_has(u3_noun a,
u3_noun b)
{
if ( u3_nul == a ) {
return c3n;
}
else {
u3_noun l_a, n_a, r_a;
u3_noun pn_a, qn_a;
if ( (c3n == u3r_trel(a, &n_a, &l_a, &r_a)) ||
(c3n == u3r_cell(n_a, &pn_a, &qn_a)) )
{
return u3m_bail(c3__exit);
}
else {
if ( (c3y == u3r_sing(b, pn_a)) ) {
return c3y;
}
else {
if ( c3y == u3qc_gor(b, pn_a) ) {
return u3qdb_has(l_a, b);
}
else return u3qdb_has(r_a, b);
}
}
}
}
u3_noun
u3wdb_has(u3_noun cor)
{
u3_noun a, b;
if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) ) {
return u3m_bail(c3__exit);
} else {
return u3qdb_has(a, b);
}
}
u3_noun
u3kdb_has(u3_noun a,
u3_noun b)
{
u3_weak c = u3qdb_has(a, b);
u3z(a); u3z(b);
if ( u3_none == c ) {
return u3m_bail(c3__exit);
}
else return c;
}

View File

@ -1,56 +0,0 @@
/* j/4/by_jab.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qdb_jab(u3_noun a,
u3_noun key,
u3_noun fun)
{
if ( u3_nul == a ) {
return u3m_bail(c3__exit);
}
else {
u3_noun l_a, n_a, r_a;
u3_noun pn_a, qn_a;
if ( (c3n == u3r_trel(a, &n_a, &l_a, &r_a)) ||
(c3n == u3r_cell(n_a, &pn_a, &qn_a) ) )
{
return u3m_bail(c3__exit);
}
else {
if ( (c3y == u3r_sing(key, pn_a)) ) {
u3_noun value = u3n_slam_on(u3k(fun), u3k(qn_a));
return u3nc(u3nc(u3k(pn_a), value), u3k(u3t(a)));
}
else {
if ( c3y == u3qc_gor(key, pn_a) ) {
return u3nt(u3k(n_a), u3qdb_jab(l_a, key, fun), u3k(r_a));
}
else {
return u3nt(u3k(n_a), u3k(l_a), u3qdb_jab(r_a, key, fun));
}
}
}
}
}
u3_noun
u3wdb_jab(u3_noun cor)
{
u3_noun a, key, fun;
if ( c3n == u3r_mean(cor, u3x_sam_2, &key,
u3x_sam_3, &fun,
u3x_con_sam, &a, 0) ) {
return u3m_bail(c3__exit);
} else {
u3_noun n = u3qdb_jab(a, key, fun);
return n;
}
}

View File

@ -1,117 +0,0 @@
/* j/4/put.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qdb_put(u3_noun a,
u3_noun b,
u3_noun c)
{
if ( u3_nul == a ) {
return u3nt(
u3nc(u3k(b),
u3k(c)),
u3_nul,
u3_nul);
}
else {
u3_noun l_a, n_a, r_a, pn_a, qn_a;
u3_noun d, l_d, n_d, r_d;
if ( (c3n == u3r_trel(a, &n_a, &l_a, &r_a)) ||
(c3n == u3r_cell(n_a, &pn_a, &qn_a)) )
{
return u3m_bail(c3__exit);
}
else if ( c3y == u3r_sing(pn_a, b) ) {
if ( c3y == u3r_sing(qn_a, c) ) {
return u3k(a);
} else {
return u3nt
(u3nc(u3k(b), u3k(c)),
u3k(l_a),
u3k(r_a));
}
}
else {
if ( c3y == u3qc_gor(b, pn_a) ) {
d = u3qdb_put(l_a, b, c);
if ( c3y == u3qc_vor(pn_a, u3h(u3h(d))) ) {
return u3nt(u3k(n_a),
d,
u3k(r_a));
}
else {
u3r_trel(d, &n_d, &l_d, &r_d);
{
u3_noun e = u3nt
(u3k(n_d),
u3k(l_d),
u3nt(u3k(n_a),
u3k(r_d),
u3k(r_a)));
u3z(d);
return e;
}
}
}
else {
d = u3qdb_put(r_a, b, c);
if ( c3y == u3qc_vor(pn_a, u3h(u3h(d))) ) {
return u3nt(u3k(n_a),
u3k(l_a),
d);
}
else {
u3r_trel(d, &n_d, &l_d, &r_d);
{
u3_noun e = u3nt
(u3k(n_d),
u3nt(u3k(n_a),
u3k(l_a),
u3k(l_d)),
u3k(r_d));
u3z(d);
return e;
}
}
}
}
}
}
u3_noun
u3wdb_put(u3_noun cor)
{
u3_noun a, b, c;
if ( c3n == u3r_mean(cor, u3x_sam_2, &b,
u3x_sam_3, &c,
u3x_con_sam, &a, 0) ) {
return u3m_bail(c3__exit);
} else {
return u3qdb_put(a, b, c);
}
}
u3_weak
u3kdb_put(u3_noun a,
u3_noun b,
u3_noun c)
{
// Bizarre asymmetry in old jets.
//
// (Mysterious comment in old glue code.)
//
u3_noun pro = u3qdb_put(a, b, c);
u3z(a); u3z(b); u3z(c);
return pro;
}

View File

@ -1,76 +0,0 @@
/* jets/d/in_bif.c
**
*/
#include "all.h"
/* internal functions
*/
static
u3_noun _i_bif_putroot(u3_noun a,
u3_noun b)
{
if ( u3_nul == a) {
return u3nt(u3k(b), u3_nul, u3_nul);
}
else {
u3_noun n_a, l_a, r_a;
if ( (c3n == u3r_trel(a, &n_a, &l_a, &r_a)) ) {
return u3m_bail(c3__exit);
}
else if ( c3y == u3r_sing(b, n_a) ) {
return u3k(a);
}
else {
u3_noun c, n_c, l_c, r_c;
u3_noun d;
if ( c3y == u3qc_hor(b, n_a) ) {
c = _i_bif_putroot(l_a, b);
u3r_trel(c, &n_c, &l_c, &r_c);
d = u3nt(u3k(n_c),
u3k(l_c),
u3nt(u3k(n_a), u3k(r_c), u3k(r_a)));
u3z(c);
return d;
} else {
c = _i_bif_putroot(r_a, b);
u3r_trel(c, &n_c, &l_c, &r_c);
d = u3nt(u3k(n_c),
u3nt(u3k(n_a), u3k(l_a), u3k(l_c)),
u3k(r_c));
u3z(c);
return d;
}
}
}
}
/* functions
*/
u3_noun u3wdi_bif(u3_noun cor)
{
u3_noun a, b;
if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) ) {
return u3m_bail(c3__exit);
} else {
return u3qdi_bif(a, b);
}
}
u3_noun u3qdi_bif(u3_noun a,
u3_noun b)
{
u3_noun c, n_c, l_c, r_c;
u3_noun d;
c = _i_bif_putroot(a, b);
u3r_trel(c, &n_c, &l_c, &r_c);
d = u3nc(u3k(l_c), u3k(r_c));
u3z(c);
return d;
}
/*
u3_weak u3kdi_bif(u3_noun a, u3_noun b);
*/

View File

@ -1,105 +0,0 @@
/* j/4/in_del.c
**
*/
#include "all.h"
/* functions
*/
static u3_noun
_rebalance(u3_noun a)
{
u3_noun l_a, n_a, r_a;
if ( c3n == u3r_trel(a, &n_a, &l_a, &r_a) ) {
return u3m_bail(c3__exit);
}
else {
if ( u3_nul == l_a) {
return u3k(r_a);
}
else if ( u3_nul == r_a) {
return u3k(l_a);
}
else {
u3_noun n_l_a, l_l_a, r_l_a;
u3_noun n_r_a, l_r_a, r_r_a;
if ( (c3n == u3r_trel(l_a, &n_l_a, &l_l_a, &r_l_a) ) ||
(c3n == u3r_trel(r_a, &n_r_a, &l_r_a, &r_r_a) ) ) {
return u3m_bail(c3__exit);
}
else {
if ( c3y == u3qc_vor(n_l_a, n_r_a) ) {
u3_noun new_right = u3nt(u3k(n_a),
u3k(r_l_a),
u3k(r_a));
u3_noun ret = u3nt(u3k(n_l_a),
u3k(l_l_a),
_rebalance(new_right));
u3z(new_right);
return ret;
}
else {
u3_noun new_left = u3nt(u3k(n_a),
u3k(l_a),
u3k(l_r_a));
u3_noun ret = u3nt(u3k(n_r_a),
_rebalance(new_left),
u3k(r_r_a));
u3z(new_left);
return ret;
}
}
}
}
}
u3_noun
u3qdi_del(u3_noun a,
u3_noun b)
{
if ( u3_nul == a ) {
return u3_nul;
}
else {
u3_noun l_a, n_a, r_a;
if ( (c3n == u3r_trel(a, &n_a, &l_a, &r_a)) ) {
return u3m_bail(c3__exit);
}
else if ( c3n == u3r_sing(n_a, b) ) {
if ( c3y == u3qc_hor(b, n_a) ) {
return u3nt(u3k(n_a),
u3qdi_del(l_a, b),
u3k(r_a));
}
else {
return u3nt(u3k(n_a),
u3k(l_a),
u3qdi_del(r_a, b));
}
}
else {
return _rebalance(a);
}
}
}
u3_noun
u3wdi_del(u3_noun cor)
{
u3_noun a, b;
if ( c3n == u3r_mean(cor, u3x_sam, &b,
u3x_con_sam, &a, 0) ) {
return u3m_bail(c3__exit);
}
else {
u3_noun n = u3qdi_del(a, b);
return n;
}
}

View File

@ -1,82 +0,0 @@
/* jets/d/in_dif.c
**
*/
#include "all.h"
/* internal functions
*/
static
u3_noun _i_dif_join(u3_noun d,
u3_noun e)
{
if ( u3_nul == d ) {
return u3k(e);
} else if (u3_nul == e) {
return u3k(d);
} else {
u3_noun n_d, l_d, r_d;
u3_noun n_e, l_e, r_e;
if ( c3n == u3r_trel(d, &n_d, &l_d, &r_d)
|| c3n == u3r_trel(e, &n_e, &l_e, &r_e) ) {
return u3m_bail(c3__exit);
} else {
if ( c3y == u3qc_vor(n_d, n_e) ) {
return u3nt(u3k(n_d),
u3k(l_d),
_i_dif_join(u3k(r_d), u3k(e)));
} else {
return u3nt(u3k(n_e),
_i_dif_join(u3k(d), u3k(l_e)),
u3k(r_e));
}
}
}
}
/* functions
*/
u3_noun u3wdi_dif(u3_noun cor)
{
u3_noun a, b;
if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) ) {
return u3m_bail(c3__exit);
} else {
return u3qdi_dif(a, b);
}
}
u3_noun u3qdi_dif(u3_noun a,
u3_noun b)
{
if ( u3_nul == b ) {
return u3k(a);
} else {
u3_noun n_b, l_b, r_b;
u3_noun c, l_c, r_c;
if ( c3n == u3r_trel(b, &n_b, &l_b, &r_b) ) {
return u3m_bail(c3__exit);
} else {
c = u3qdi_bif(a, n_b);
if ( c3n == u3r_cell(c, &l_c, &r_c) ) {
return u3m_bail(c3__exit);
} else {
u3_noun d;
u3_noun e;
d = u3qdi_dif(l_c, l_b);
e = u3qdi_dif(r_c, r_b);
u3z(c);
return _i_dif_join(d, e);
}
}
}
}
/*
u3_weak u3kdi_dif(u3_noun a, u3_noun b);
*/

View File

@ -1,58 +0,0 @@
/* j/4/gas.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qdi_gas(u3_noun a,
u3_noun b)
{
if ( u3_nul == b ) {
return u3k(a);
}
else {
if ( c3n == u3du(b) ) {
return u3m_bail(c3__exit);
} else {
u3_noun i_b = u3h(b);
u3_noun t_b = u3t(b);
u3_noun c;
if ( u3_none == (c = u3qdi_put(a, i_b)) ) {
return u3m_bail(c3__exit);
} else {
u3_noun d = u3qdi_gas(c, t_b);
u3z(c);
return d;
}
}
}
}
u3_noun
u3wdi_gas(u3_noun cor)
{
u3_noun a, b;
if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) ) {
return u3m_bail(c3__exit);
} else {
return u3qdi_gas(a, b);
}
}
u3_noun
u3kdi_gas(u3_noun a,
u3_noun b)
{
u3_weak c = u3qdi_gas(a, b);
u3z(a); u3z(b);
if ( u3_none == c ) {
return u3m_bail(c3__exit);
}
else return c;
}

View File

@ -1,58 +0,0 @@
/* j/4/in_has.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qdi_has(u3_noun a,
u3_noun b)
{
if ( u3_nul == a ) {
return c3n;
}
else {
u3_noun l_a, n_a, r_a;
if ( (c3n == u3r_mean(a, 2, &n_a, 6, &l_a, 7, &r_a, 0)) ) {
return u3m_bail(c3__exit);
}
else {
if ( (c3y == u3r_sing(b, n_a)) ) {
return c3y;
}
else {
if ( c3y == u3qc_hor(b, n_a) ) {
return u3qdi_has(l_a, b);
}
else return u3qdi_has(r_a, b);
}
}
}
}
u3_noun
u3wdi_has(u3_noun cor)
{
u3_noun a, b;
if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) ) {
return u3m_bail(c3__exit);
} else {
return u3qdi_has(a, b);
}
}
u3_noun
u3kdi_has(u3_noun a,
u3_noun b)
{
u3_weak c = u3qdi_has(a, b);
u3z(a); u3z(b);
if ( u3_none == c ) {
return u3m_bail(c3__exit);
}
else return c;
}

View File

@ -1,80 +0,0 @@
/* j/4/in_mer.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qdi_mer(u3_noun a,
u3_noun b)
{
if ( u3_nul == a ) {
return u3k(b);
}
else if ( u3_nul == b ) {
return u3k(a);
}
else {
u3_noun l_a, n_a, r_a, lr_a; // XX copy tree boilerplate to other pt4
u3_noun l_b, n_b, r_b, lr_b;
u3_noun c;
if ( (c3n == u3r_cell(a, &n_a, &lr_a)) ) {
return u3m_bail(c3__exit);
}
else if ( (c3n == u3r_cell(b, &n_b, &lr_b)) ) {
return u3m_bail(c3__exit);
}
else {
if ( c3y == u3qc_vor(n_b, n_a) ) {
c = a; a = b; b = c;
c = n_a; n_a = n_b; n_b = c;
c = lr_a; lr_a = lr_b; lr_b = c;
}
if ( c3n == u3r_cell(lr_a, &l_a, &r_a) ) {
return u3m_bail(c3__exit);
}
else if ( c3n == u3r_cell(lr_b, &l_b, &r_b) ) {
return u3m_bail(c3__exit);
}
else if ( c3y == u3r_sing(n_a, n_b) ) {
return u3nt(u3k(n_a),
u3qdi_mer(l_a, l_b),
u3qdi_mer(r_a, r_b));
}
else if ( c3y == u3qc_hor(n_b, n_a) ) {
return u3qdi_mer(u3nt(n_a,
u3qdi_mer(l_a,
u3nt(n_b,
l_b,
u3_nul)),
r_a),
r_b);
}
else {
return u3qdi_mer(u3nt(n_a,
l_a,
u3qdi_mer(r_a,
u3nt(n_b,
u3_nul,
r_b))),
l_b);
}
}
}
}
u3_noun
u3wdi_mer(u3_noun cor)
{
u3_noun a, b;
if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) ) {
return u3m_bail(c3__exit);
}
else {
return u3qdi_mer(a, b);
}
}

View File

@ -1,102 +0,0 @@
/* j/4/in_put.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qdi_put(u3_noun a,
u3_noun b)
{
if ( u3_nul == a ) {
return u3nt(u3k(b), u3_nul, u3_nul);
}
else {
u3_noun l_a, n_a, r_a, lr_a; // XX copy tree boilerplate to other pt4
u3_noun c, l_c, n_c, r_c;
if ( (c3n == u3r_cell(a, &n_a, &lr_a)) ) {
return u3m_bail(c3__exit);
}
else if ( c3y == u3r_sing(n_a, b) ) {
return u3k(a);
}
else if ( c3n == u3r_cell(lr_a, &l_a, &r_a) ) {
return u3m_bail(c3__exit);
}
else {
if ( c3y == u3qc_hor(b, n_a) ) {
c = u3qdi_put(l_a, b);
if ( c3y == u3qc_vor(n_a, u3h(c)) ) {
return u3nt(u3k(n_a),
c,
u3k(r_a));
}
else {
u3r_trel(c, &n_c, &l_c, &r_c);
{
u3_noun d = u3nt(u3k(n_c),
u3k(l_c),
u3nt(u3k(n_a),
u3k(r_c),
u3k(r_a)));
u3z(c);
return d;
}
}
}
else {
c = u3qdi_put(r_a, b);
if ( c3y == u3qc_vor(n_a, u3h(c)) ) {
return u3nt(u3k(n_a),
u3k(l_a),
c);
}
else {
u3r_trel(c, &n_c, &l_c, &r_c);
{
u3_noun d = u3nt(u3k(n_c),
u3nt(u3k(n_a),
u3k(l_a),
u3k(l_c)),
u3k(r_c));
u3z(c);
return d;
}
}
}
}
}
}
u3_noun
u3wdi_put(u3_noun cor)
{
u3_noun a, b;
if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) ) {
return u3m_bail(c3__exit);
} else {
return u3qdi_put(a, b);
}
}
u3_weak
u3kdi_put(u3_noun a,
u3_noun b)
{
// Bizarre asymmetry in old jets.
//
// (Mysterious comment in old glue code.)
//
u3_noun pro = u3qdi_put(a, b);
u3z(a); u3z(b);
return pro;
}

View File

@ -1,104 +0,0 @@
/* j/4/in_uni.c
**
*/
#include "all.h"
/* internal functions
*/
static u3_noun
_in_uni(u3_noun a, u3_noun b)
{
u3_noun n_a, l_a, r_a,
n_b, l_b, r_b,
neb, sub, naw, pro;
if ( u3_nul == a ) {
return u3k(b);
}
else if ( u3_nul == b ) {
return u3k(a);
}
else if ( (c3n == u3r_trel(a, &n_a, &l_a, &r_a))
|| (c3n == u3r_trel(b, &n_b, &l_b, &r_b)) )
{
return u3m_bail(c3__exit);
}
else if ( c3n == u3qc_vor(n_a, n_b) ) {
if ( c3y == u3r_sing(n_a, n_b) ) {
return u3nt(u3k(n_b), _in_uni(l_a, l_b), _in_uni(r_a, r_b));
}
else if ( c3y == u3qc_hor(n_a, n_b) ) {
naw = u3nt(u3k(n_a), u3k(l_a), u3_nul);
sub = _in_uni(naw, l_b);
neb = u3nt(u3k(n_b), sub, u3k(r_b));
pro = _in_uni(r_a, neb);
u3z(naw); u3z(neb);
return pro;
}
else {
naw = u3nt(u3k(n_a), u3_nul, u3k(r_a));
sub = _in_uni(naw, r_b);
neb = u3nt(u3k(n_b), u3k(l_b), sub);
pro = _in_uni(l_a, neb);
u3z(naw); u3z(neb);
return pro;
}
}
else if ( c3y == u3r_sing(n_b, n_a) ) {
return u3nt(u3k(n_b), _in_uni(l_a, l_b), _in_uni(r_a, r_b));
}
else if ( c3y == u3qc_hor(n_b, n_a) ) {
neb = u3nt(u3k(n_b), u3k(l_b), u3_nul);
sub = _in_uni(l_a, neb);
naw = u3nt(u3k(n_a), sub, u3k(r_a));
pro = _in_uni(naw, r_b);
u3z(neb); u3z(naw);
return pro;
}
else {
neb = u3nt(u3k(n_b), u3_nul, u3k(r_b));
sub = _in_uni(r_a, neb);
naw = u3nt(u3k(n_a), u3k(l_a), sub);
pro = _in_uni(naw, l_b);
u3z(neb); u3z(naw);
return pro;
}
}
/* functions
*/
u3_noun
u3kdi_uni(u3_noun a,
u3_noun b)
{
u3_noun c = u3qdi_uni(a, b);
u3z(a);
u3z(b);
return c;
}
u3_noun
u3qdi_uni(u3_noun a,
u3_noun b)
{
if ( c3y == u3r_sing(a, b) ) {
return u3k(a);
}
else {
return _in_uni(a, b);
}
}
u3_noun
u3wdi_uni(u3_noun cor)
{
u3_noun a, b;
if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) ) {
return u3m_bail(c3__exit);
} else {
return u3qdi_uni(a, b);
}
}

View File

@ -1,78 +0,0 @@
/* j/6/fork.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qf_forq(u3_noun hoz,
u3_noun bur)
{
if ( c3y == u3r_sing(hoz, bur) ) {
return u3k(hoz);
}
else if ( c3__void == bur ) {
return u3k(hoz);
}
else if ( c3__void == hoz ) {
return u3k(bur);
}
else return u3kf_fork(u3nt(u3k(hoz), u3k(bur), u3_nul));
}
u3_noun
u3qf_fork(u3_noun yed)
{
u3_noun lez = u3_nul;
while ( u3_nul != yed ) {
u3_noun i_yed = u3h(yed);
if ( c3__void != i_yed ) {
if ( (c3y == u3du(i_yed)) && (c3__fork == u3h(i_yed)) ) {
lez = u3kdi_uni(lez, u3k(u3t(i_yed)));
}
else {
lez = u3kdi_put(lez, u3k(i_yed));
}
}
yed = u3t(yed);
}
if ( u3_nul == lez ) {
return c3__void;
}
else if ( (u3_nul == u3h(u3t(lez))) && (u3_nul == u3t(u3t(lez))) ) {
u3_noun ret = u3k(u3h(lez));
u3z(lez);
return ret;
}
else {
return u3nc(c3__fork, lez);
}
}
u3_noun
u3wf_fork(u3_noun cor)
{
u3_noun yed;
if ( c3n == u3r_mean(cor, u3x_sam, &yed, 0) ) {
return u3m_bail(c3__fail);
} else {
return u3qf_fork(yed);
}
}
u3_noun
u3kf_fork(u3_noun yed)
{
u3_noun ret = u3qf_fork(yed);
u3z(yed);
return ret;
}

View File

@ -1,134 +0,0 @@
/* j/6/look.c
**
*/
#include "all.h"
/* internals
*/
static u3_noun
_look_in(u3_noun cog,
u3_noun dab,
u3_atom axe)
{
if ( u3_nul == dab ) {
return u3_nul;
}
else {
u3_noun n_dab, l_dab, r_dab;
u3r_trel(dab, &n_dab, &l_dab, &r_dab);
if ( c3n == u3du(n_dab) ) {
// return u3m_bail(c3__fail);
fprintf(stderr, "bad look\r\n");
return u3m_bail(c3__exit) ;
}
else {
u3_noun pn_dab = u3h(n_dab);
u3_noun qn_dab = u3t(n_dab);
if ( (u3_nul == l_dab) && (u3_nul == r_dab) ) {
if ( (c3y == u3du(qn_dab)) &&
(c3y == u3r_sing(cog, pn_dab)) ) {
return u3nt(u3_nul,
u3k(axe),
u3k(qn_dab));
}
else {
return u3_nul;
}
}
else if ( (u3_nul == l_dab) ) {
if ( (c3y == u3du(qn_dab)) &&
(c3y == u3r_sing(cog, pn_dab)) ) {
return u3nt(u3_nul,
u3qc_peg(axe, 2),
u3k(qn_dab));
}
else {
if ( c3y == u3qc_gor(cog, pn_dab) ) {
return u3_nul;
}
else {
u3_noun pro;
axe = u3qc_peg(axe, 3);
pro = _look_in(cog, r_dab, axe);
u3z(axe);
return pro;
}
}
}
else if ( (u3_nul == r_dab) ) {
if ( (c3y == u3du(qn_dab)) &&
(c3y == u3r_sing(cog, pn_dab)) ) {
return u3nt(u3_nul,
u3qc_peg(axe, 2),
u3k(qn_dab));
}
else {
if ( c3y == u3qc_gor(cog, pn_dab) ) {
u3_noun pro;
axe = u3qc_peg(axe, 3);
pro = _look_in(cog, l_dab, axe);
u3z(axe);
return pro;
}
else {
return u3_nul;
}
}
}
else {
if ( (c3y == u3du(qn_dab)) &&
(c3y == u3r_sing(cog, pn_dab)) ) {
return u3nt(u3_nul,
u3qc_peg(axe, 2),
u3k(qn_dab));
}
else {
if ( c3y == u3qc_gor(cog, pn_dab) ) {
u3_noun pro;
axe = u3qc_peg(axe, 6);
pro = _look_in(cog, l_dab, axe);
u3z(axe);
return pro;
}
else {
u3_noun pro;
axe = u3qc_peg(axe, 7);
pro = _look_in(cog, r_dab, axe);
u3z(axe);
return pro;
}
}
}
}
}
}
/* functions
*/
u3_noun
u3qf_look(u3_noun cog,
u3_noun dab)
{
return _look_in(cog, dab, 1);
}
u3_noun
u3wf_look(u3_noun cor)
{
u3_noun cog, dab;
if ( c3n == u3r_mean(cor, u3x_sam_2, &cog, u3x_sam_3, &dab, 0) ) {
return u3m_bail(c3__fail);
} else {
return u3qf_look(cog, dab);
}
}

View File

@ -1,133 +0,0 @@
/* j/6/loot.c
**
*/
#include "all.h"
/* internals
*/
static u3_noun
_loot_in(u3_noun cog,
u3_noun dom,
u3_atom axe)
{
if ( u3_nul == dom ) {
return u3_nul;
}
else {
u3_noun n_dom, l_dom, r_dom;
u3r_trel(dom, &n_dom, &l_dom, &r_dom);
if ( c3n == u3du(n_dom) ) {
return u3m_bail(c3__fail);
}
else {
u3_noun qqn_dom = u3t(u3t(n_dom));
u3_noun yep = u3qf_look(cog, qqn_dom);
if ( (u3_nul == l_dom) && (u3_nul == r_dom) ) {
if ( u3_nul == yep ) {
return u3_nul;
} else {
u3_noun u_yep = u3t(yep);
u3_noun pro;
pro = u3nt(u3_nul, u3qc_peg(axe, u3h(u_yep)), u3k(u3t(u_yep)));
u3z(yep);
return pro;
}
}
else if ( (u3_nul == l_dom) ) {
if ( u3_nul == yep ) {
u3_noun nax = u3qc_peg(axe, 3);
u3_noun pro;
pro = _loot_in(cog, r_dom, nax);
u3z(nax);
return pro;
}
else {
u3_noun u_yep = u3t(yep);
u3_noun nax = u3qc_peg(axe, 2);
u3_noun pro;
pro = u3nt(u3_nul, u3qc_peg(nax, u3h(u_yep)), u3k(u3t(u_yep)));
u3z(nax);
u3z(yep);
return pro;
}
}
else if ( (u3_nul == r_dom) ) {
if ( u3_nul == yep ) {
u3_noun nax = u3qc_peg(axe, 3);
u3_noun pro;
pro = _loot_in(cog, l_dom, nax);
u3z(nax);
return pro;
}
else {
u3_noun u_yep = u3t(yep);
u3_noun nax = u3qc_peg(axe, 2);
u3_noun pro;
pro = u3nt(u3_nul, u3qc_peg(nax, u3h(u_yep)), u3k(u3t(u_yep)));
u3z(nax);
u3z(yep);
return pro;
}
}
else {
if ( u3_nul == yep ) {
u3_noun nax = u3qc_peg(axe, 6);
u3_noun pey;
pey = _loot_in(cog, l_dom, nax);
u3z(nax);
if ( u3_nul != pey ) {
return pey;
}
else {
u3_noun nax = u3qc_peg(axe, 7);
u3_noun pro;
pro = _loot_in(cog, r_dom, nax);
u3z(nax);
return pro;
}
}
else {
u3_noun u_yep = u3t(yep);
u3_noun nax = u3qc_peg(axe, 2);
u3_noun pro;
pro = u3nt(u3_nul, u3qc_peg(nax, u3h(u_yep)), u3k(u3t(u_yep)));
u3z(nax);
u3z(yep);
return pro;
}
}
}
}
}
/* functions
*/
u3_noun
u3qf_loot(u3_noun cog,
u3_noun dom)
{
return _loot_in(cog, dom, 1);
}
u3_noun
u3wf_loot(u3_noun cor)
{
u3_noun cog, dom;
if ( c3n == u3r_mean(cor, u3x_sam_2, &cog, u3x_sam_3, &dom, 0) ) {
return u3m_bail(c3__fail);
} else {
return u3qf_loot(cog, dom);
}
}

View File

@ -1,100 +0,0 @@
/* j/6/ut.c
**
*/
#include "all.h"
extern void
u3_pier_tank(c3_l tab_l, u3_noun tac);
// duck: create a duck core for mean.
//
u3_noun
u3qfu_duck(u3_noun van,
u3_noun typ)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(typ), 0);
u3_noun ret = u3j_cook("u3qfu_duck-dune", u3k(von), "dune");
u3z(von);
return ret;
}
// dung: create a dunk core for mean (noun caption)
//
u3_noun
u3qfu_dung(u3_noun van,
u3_noun paz,
u3_noun typ)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(typ), 0);
u3_noun duq = u3j_cook("u3qfu_dung-dunk", u3k(von), "dunk");
u3_noun ret = u3i_molt(u3k(duq), u3x_sam, u3k(paz), 0);
u3z(duq);
u3z(von);
return ret;
}
// dunq: create a dunk core for mean
//
u3_noun
u3qfu_dunq(u3_noun van,
const c3_c* paz_c,
u3_noun typ)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(typ), 0);
u3_noun duq = u3j_cook("u3qfu_dunq-dunk", u3k(von), "dunk");
u3_noun paz = u3i_string(paz_c);
u3_noun ret = u3i_molt(u3k(duq), u3x_sam, u3k(paz), 0);
u3z(paz);
u3z(duq);
u3z(von);
return ret;
}
// dump: dump a type.
//
void
u3qfu_dump(u3_noun van,
const c3_c* paz_c,
u3_noun typ)
{
c3_c* pfix_c = u3r_string((c3y == u3du(typ)) ? u3h(typ) : typ);
c3_c ugh_c[1024];
sprintf(ugh_c, "%s: %s: 0x%8x:",
paz_c, pfix_c, u3r_mug(typ));
#if 0
u3_pier_tank(0, u3n_kick_on(u3qfu_dunq(van, ugh_c, typ)));
#endif
}
// shew: create a show core for mean
//
u3_noun
u3qfu_shew(u3_noun van,
u3_noun mol)
{
u3_noun sho = u3j_cook("u3qfu_shew-show", u3k(van), "show");
u3_noun ret = u3i_molt(u3k(sho), u3x_sam, u3k(mol), 0);
u3z(sho);
u3z(mol);
return ret;
}
// shep: show with caption and style
//
u3_noun
u3qfu_shep(u3_noun van,
const c3_c* paz_c,
u3_noun sty,
u3_noun mol)
{
return u3qfu_shew(van,
u3nc(u3nc('c', u3i_string(paz_c)),
u3nc(u3k(sty), mol)));
}

View File

@ -1,93 +0,0 @@
/* j/6/ut_buss.c
**
*/
#include "all.h"
/* logic
*/
static u3_noun
_cqfu_buss(u3_noun van,
u3_noun sut,
u3_noun cog,
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("_cqfu_buss-buss", von, "buss");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(cog),
u3x_sam_3,
u3k(gen),
0));
}
static u3_noun
_cqfu_busk(u3_noun van,
u3_noun sut,
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("_cqfu_busk-busk", von, "busk");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(gen),
0));
}
/* boilerplate
*/
u3_noun
u3wfu_buss(u3_noun cor)
{
u3_noun sut, cog, gen, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &cog,
u3x_sam_3, &gen,
u3x_con, &van,
0)) ||
(c3n == u3ud(cog)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_buss(van, sut, cog, gen);
}
}
u3_noun
u3qfu_buss(u3_noun van,
u3_noun sut,
u3_noun cog,
u3_noun gen)
{
return _cqfu_buss(van, sut, cog, gen);
}
u3_noun
u3wfu_busk(u3_noun cor)
{
u3_noun sut, gen, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &gen,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_busk(van, sut, gen);
}
}
u3_noun
u3qfu_busk(u3_noun van,
u3_noun sut,
u3_noun gen)
{
return _cqfu_busk(van, sut, gen);
}

View File

@ -1,88 +0,0 @@
/* j/6/ut_conk.c
**
*/
#include "all.h"
/* logic
*/
static u3_noun
_cqfu_conk(u3_noun van,
u3_noun sut,
u3_noun got)
{
if ( c3y == u3ud(got) ) {
u3_noun ret = u3qf_face(u3k(got), sut);
return ret;
}
else switch ( u3h(got) ) {
default: return u3m_bail(c3__fail);
case 0: {
return u3k(sut);
}
case 1: {
u3_noun cok = _cqfu_conk(van, sut, u3t(u3t(got)));
u3_noun nux = u3k(u3h(u3t(got)));
u3_noun ret = u3qf_face(nux, cok);
u3z(nux);
u3z(cok);
return ret;
}
case 2: {
u3_noun vet = u3r_at(u3qfu_van_vet, van);
u3_noun hed, tal, deh, lat, ret;
if ( c3y == vet ) {
u3_noun cel = u3nt(c3__cell, c3__noun, c3__noun);
if ( c3n == u3qfu_nest(van, cel, c3y, sut) ) {
return u3m_bail(c3__fail);
}
u3z(cel);
}
hed = u3qfu_peek(van, sut, c3__both, 2);
tal = u3qfu_peek(van, sut, c3__both, 3);
deh = _cqfu_conk(van, hed, u3h(u3t(got)));
lat = _cqfu_conk(van, tal, u3t(u3t(got)));
ret = u3qf_cell(deh, lat);
u3z(lat);
u3z(deh);
u3z(tal);
u3z(hed);
return ret;
}
}
}
/* boilerplate
*/
u3_noun
u3wfu_conk(u3_noun cor)
{
u3_noun sut, got, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &got,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_conk(van, sut, got);
}
}
u3_noun
u3qfu_conk(u3_noun van,
u3_noun sut,
u3_noun got)
{
return _cqfu_conk(van, sut, got);
}

View File

@ -1,271 +0,0 @@
/* j/6/crop.c
**
*/
#include "all.h"
/* logic
*/
static u3_noun
_crop_dext(u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_crop_sint(u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_crop_repo(u3_noun van,
u3_noun sut,
u3_noun ref,
u3_noun bix)
{
u3_noun rep = u3qfu_repo(van, sut);
u3_noun ret = _crop_dext(van, rep, ref, bix);
if ( c3y == u3r_sing(ret, rep) ) {
if ( c3__void == rep ) {
return c3__void;
} else {
u3z(rep);
u3z(ret);
return u3k(sut);
}
} else {
u3z(rep);
return ret;
}
}
static u3_noun
_crop_dext_fork(u3_noun van, u3_noun p_sut, u3_noun ref, u3_noun bix)
{
if ( u3_nul == p_sut ) {
return u3_nul;
}
else {
return u3nc(_crop_dext(van, u3h(p_sut), ref, bix),
_crop_dext_fork(van, u3t(p_sut), ref, bix));
}
}
static u3_noun
_crop_sint_fork(u3_noun van, u3_noun sut, u3_noun p_ref, u3_noun bix)
{
if ( u3_nul == p_ref ) {
return u3k(sut);
}
else {
u3_noun tuz = _crop_dext(van, sut, u3h(p_ref), bix);
u3_noun zat = _crop_sint_fork(van, tuz, u3t(p_ref), bix);
u3z(tuz);
return zat;
}
}
static u3_noun
_crop_dext(u3_noun van,
u3_noun sut,
u3_noun ref,
u3_noun bix)
{
u3_noun p_sut, q_sut, p_ref, q_ref;
if ( c3n == u3du(ref) ) {
switch ( ref ) {
case c3__void: return u3k(sut);
case c3__noun: return c3__void;
default: return u3m_bail(c3__fail);
}
}
if ( c3y == u3r_sing(sut, ref) ) {
return c3__void;
}
if ( c3n == u3du(sut) ) switch ( sut ) {
default: return u3m_bail(c3__fail);
case c3__noun: return _crop_repo(van, sut, ref, bix);
case c3__void: return c3__void;
}
else switch ( u3h(sut) ) {
default: return u3m_bail(c3__fail);
case c3__atom: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
if ( c3__atom == u3h(ref) ) {
u3x_cell(u3t(ref), &p_ref, &q_ref);
if ( c3y == u3du(q_sut) ) {
if ( c3y == u3du(q_ref) ) {
if ( c3y == u3r_sing(q_sut, q_ref) ) {
return c3__void;
} else {
return u3k(sut);
}
} else {
return c3__void;
}
}
else {
if ( c3y == u3du(q_ref) ) {
return u3k(sut);
}
else return c3__void;
}
}
else if ( c3__cell == u3h(ref) ) {
return u3k(sut);
}
else return _crop_sint(van, sut, ref, bix);
}
case c3__cell: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
if ( c3__atom == u3h(ref) ) {
return u3k(sut);
}
else if ( c3__cell == u3h(ref) ) {
u3x_cell(u3t(ref), &p_ref, &q_ref);
if ( c3y == u3qfu_nest(van, p_ref, c3n, p_sut) )
{
u3_noun foz = _crop_dext(van, q_sut, q_ref, bix);
u3_noun ret = u3qf_cell(p_sut, foz);
u3z(foz);
return ret;
}
else return u3k(sut);
}
else return _crop_sint(van, sut, ref, bix);
}
case c3__core:
{
if ( (c3__atom == u3h(ref)) ||
(c3__cell == u3h(ref)) ) {
return u3k(sut);
}
else return _crop_sint(van, sut, ref, bix);
}
case c3__hint: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun foz = _crop_dext(van, q_sut, ref, bix);
u3_noun ret = u3qf_hint(p_sut, foz);
u3z(foz);
return ret;
}
case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun foz = _crop_dext(van, q_sut, ref, bix);
u3_noun ret = u3qf_face(p_sut, foz);
u3z(foz);
return ret;
}
case c3__fork: p_sut = u3t(sut);
{
u3_noun yed = u3qdi_tap(p_sut);
u3_noun ret = u3kf_fork(_crop_dext_fork(van, yed, ref, bix));
u3z(yed);
return ret;
}
case c3__hold:
{
u3_noun hud = u3nc(u3k(sut), u3k(ref));
if ( c3y == u3qdi_has(bix, hud) ) {
# if 0
u3_noun dun = u3qfu_dunq(van, "type", sut);
u3_noun niz = u3qfu_dunq(van, "over", ref);
u3t_push(u3nc(c3__mean, dun));
u3t_push(u3nc(c3__mean, niz));
# endif
return u3m_error("crop-loop");
} else {
u3_noun bux = u3qdi_put(bix, hud);
u3_noun ret = _crop_repo(van, sut, ref, bux);
u3z(hud);
u3z(bux);
return ret;
}
}
}
}
static u3_noun
_crop_sint(u3_noun van,
u3_noun sut,
u3_noun ref,
u3_noun bix)
{
u3_noun p_ref, q_ref;
switch ( u3h(ref) ) {
default: return u3m_bail(c3__fail);
case c3__core:
case c3__hint:
case c3__face: u3x_cell(u3t(ref), &p_ref, &q_ref);
{
return _crop_dext(van, sut, q_ref, bix);
}
case c3__fork: p_ref = u3t(ref);
{
u3_noun yed = u3qdi_tap(p_ref);
u3_noun ret = _crop_sint_fork(van, sut, yed, bix);
u3z(yed);
return ret;
}
case c3__hold:
{
u3_noun rep = u3qfu_repo(van, ref);
u3_noun ret = _crop_dext(van, sut, rep, bix);
u3z(rep);
return ret;
}
}
}
static u3_noun
_cqfu_crop(u3_noun van,
u3_noun sut,
u3_noun ref)
{
return _crop_dext(van, sut, ref, u3_nul);
}
/* boilerplate
*/
u3_noun
u3wfu_crop(u3_noun cor)
{
u3_noun sut, ref, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &ref, u3x_con, &van, 0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_crop(van, sut, ref);
}
}
u3_noun
u3qfu_crop(u3_noun van,
u3_noun sut,
u3_noun ref)
{
c3_m fun_m = 141 + c3__crop + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, ref);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_crop(van, sut, ref);
return u3z_save_2(fun_m, sut, ref, pro);
}
}

View File

@ -1,914 +0,0 @@
/* j/6/find.c
**
*/
#include "all.h"
static u3_noun
_find_buck(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil);
/* `u3qfu_felt_arm` is a helper function for
* u3qfu_felt. It handles the case in which the
* opal is for an arm, by creating a list of
* parent core types. These will be converted to
* a single `fork` type.
*/
static u3_noun
u3qfu_felt_arm(u3_noun lis)
{
if ( u3_nul == lis ) {
return u3_nul;
}
else {
u3_noun i_lis, t_lis, fot, typ;
u3x_cell(lis, &i_lis, &t_lis);
u3x_cell(i_lis, &typ, &fot);
if ( (c3n == u3du(typ)) ||
(c3__core != u3h(typ)) ) {
return u3m_error("felt-core");
}
else {
u3_noun p_typ, q_typ, pq_typ, qq_typ, rq_typ;
u3x_cell(u3t(typ), &p_typ, &q_typ);
u3x_trel(q_typ, &pq_typ, &qq_typ, &rq_typ);
u3_noun dox = u3nt(c3__core, u3k(qq_typ), u3k(q_typ));
return u3nc(dox, u3qfu_felt_arm(t_lis));
}
}
}
/* `u3qfu_felt` takes an opal, lap, and converts
* it to a type. The opal comes from the last
* limb of the wing processed by `+fond`. The
* type is used in +fond as the subject type of
* the next limb in the wing.
*/
static u3_noun
u3qfu_felt(u3_noun lap)
{
u3_noun lim, mil;
u3x_cell(lap, &lim, &mil);
if ( c3y == lim ) {
return u3k(mil);
}
else if ( c3n == lim ) {
u3_noun p_lap, q_lap, lis, hos;
u3x_cell(mil, &p_lap, &q_lap);
lis = u3qdi_tap(q_lap);
hos = u3qfu_felt_arm(lis);
u3z(lis);
return u3kf_fork(hos);
}
else {
u3m_bail(c3__exit);
}
}
static u3_noun
u3qfu_fund(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("u3qfu_fund-fund", von, "fund");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(way),
u3x_sam_3,
u3k(gen),
0));
}
static u3_noun
u3qfu_fine(u3_noun van,
u3_noun sut,
u3_noun tor)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("u3qfu_fine-fine", von, "fine");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(tor),
0));
}
static u3_noun
_find_buck_here(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
if ( 0 == p_heg ) {
return u3nt
(c3y,
u3nt(u3_nul,
u3nc(u3_nul, u3k(axe)),
u3k(lon)),
u3nc(c3y, u3k(sut)));
}
else {
return u3nt
(c3n, c3y, u3qa_dec(p_heg));
}
}
static u3_noun
_find_buck_lose(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
return u3nt(c3n, c3y, u3k(p_heg));
}
static u3_noun
_find_buck_stop(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
if ( u3_nul == q_heg ) {
return _find_buck_here(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
else {
return _find_buck_lose(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
}
static u3_noun
_find_buck_cell(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
u3_noun p_sut, q_sut;
u3x_cell(u3t(sut), &p_sut, &q_sut);
{
if ( u3_nul == q_heg ) {
return _find_buck_here(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
else {
u3_noun exa = u3qc_peg(axe, 2);
u3_noun hed = _find_buck(van, p_sut, way, p_heg, q_heg, exa, lon, gil);
u3z(exa);
if ( (u3_nul == hed) || (c3y == u3h(hed)) || (c3n == u3h(u3t(hed))) ) {
return hed;
}
else {
u3_noun exa = u3qc_peg(axe, 3);
u3_noun tal = _find_buck
(van, q_sut, way, u3t(u3t(hed)), q_heg, exa, lon, gil);
u3z(exa);
u3z(hed);
return tal;
}
}
}
}
static u3_noun
_find_buck_core(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
u3_noun p_sut, q_sut, pq_sut, qq_sut, rq_sut, prq_sut, qrq_sut;
u3_noun ppq_sut, qpq_sut, rpq_sut;
u3x_cell(u3t(sut), &p_sut, &q_sut);
u3x_trel(q_sut, &pq_sut, &qq_sut, &rq_sut);
u3x_trel(pq_sut, &ppq_sut, &qpq_sut, &rpq_sut);
u3x_cell(rq_sut, &prq_sut, &qrq_sut);
{
if ( u3_nul == q_heg ) {
return _find_buck_here(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
else {
u3_noun zem = u3qf_loot(u3t(q_heg), qrq_sut);
if ( (u3_nul != zem) && (0 != p_heg) ) {
u3_noun ped;
ped = u3qa_dec(p_heg);
u3z(p_heg); p_heg = ped;
u3z(zem);
zem = u3_nul;
}
if ( u3_nul != zem ) {
u3_noun u_zem = u3t(zem);
u3_noun pu_zem = u3h(u_zem);
u3_noun qu_zem = u3t(u_zem);
u3_noun zut;
u3_noun pro;
#if 1
if ( qpq_sut == c3__wet ) {
zut = u3nc(c3__wet, u3k(qu_zem));
}
else if ( qpq_sut == c3__dry ) {
zut = u3nc(c3__dry, u3k(qu_zem));
}
else u3m_bail(c3__fail);
#endif
pro = u3nt
(c3y,
u3nc(u3nc(u3_nul, u3k(axe)), u3k(lon)),
u3nt(c3n,
u3qc_peg(2, pu_zem),
u3nt(u3nc(u3k(sut), zut), u3_nul, u3_nul)));
u3z(zem);
return pro;
}
else {
u3_noun pec = u3qfu_peel(van, sut, way, rpq_sut);
u3_noun pro;
if ( c3n == u3h(pec) ) {
pro = _find_buck_lose(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
else if ( c3y == u3t(pec) ) {
u3_noun exa = u3qc_peg(axe, 3);
pro = _find_buck(van, p_sut, way, p_heg, q_heg, exa, lon, gil);
u3z(exa);
}
else {
u3_noun sam = u3qfu_peek(van, p_sut, way, 2);
u3_noun exa = u3qc_peg(axe, 6);
pro = _find_buck(van, sam, way, p_heg, q_heg, exa, lon, gil);
u3z(exa);
u3z(sam);
}
u3z(pec);
return pro;
}
}
}
}
static u3_noun
_find_twin(u3_noun van,
u3_noun hax,
u3_noun yor)
{
if ( c3y == u3r_sing(hax, yor) ) {
return u3k(hax);
}
else if ( u3_nul == hax ) {
return u3k(yor);
}
else if ( u3_nul == yor ) {
return u3k(hax);
}
else if ( c3n == u3h(hax) ) {
if ( (c3n != u3h(yor)) ) {
return u3m_error("find-fork-a");
}
else {
u3_noun p_hax = u3t(hax); // (each @ud {span nock})
u3_noun p_yor = u3t(yor); // (each @ud {span nock})
if ( (c3n != u3h(p_hax)) || (c3n != u3h(p_yor)) ) {
return u3m_error("find-fork-b");
}
else {
u3_noun pp_hax = u3t(p_hax); // {span nock}
u3_noun pp_yor = u3t(p_yor); // {span nock}
u3_noun ppp_hax = u3h(pp_hax); // span
u3_noun ppp_yor = u3h(pp_yor); // span
u3_noun qpp_hax = u3t(pp_hax); // nock
u3_noun qpp_yor = u3t(pp_yor); // nock
if ( c3n == u3r_sing(qpp_hax, qpp_yor) ) {
return u3m_error("find-fork-c");
}
return u3nt(c3n,
c3n,
u3nc(
u3kf_fork(u3nt(u3k(ppp_hax), u3k(ppp_yor), u3_nul)),
u3k(qpp_hax)));
}
}
}
else {
if ( c3n == u3h(yor) ) {
return u3m_error("find-fork-d");
}
else {
u3_noun p_hax = u3t(hax); // {vein opal}
u3_noun p_yor = u3t(yor); // {vein opal}
u3_noun pp_hax = u3h(p_hax); // vein
u3_noun pp_yor = u3h(p_yor); // vein
u3_noun qp_hax = u3t(p_hax); // opal
u3_noun qp_yor = u3t(p_yor); // opal
if ( c3n == u3r_sing(pp_hax, pp_yor) ) {
return u3m_error("find-fork-e");
}
else {
if ( c3y == u3h(qp_hax) ) {
if ( c3y != u3h(qp_yor) ) {
return u3m_error("find-fork-f");
} else {
u3_noun pqp_hax = u3t(qp_hax); // type
u3_noun pqp_yor = u3t(qp_yor); // type
return
u3nt(c3y,
u3k(pp_hax),
u3nc(c3y, u3kf_fork
(u3nt(u3k(pqp_hax), u3k(pqp_yor), u3_nul))));
}
}
else if ( c3n != u3h(qp_yor) ) {
return u3m_error("find-fork-g");
} else {
u3_noun pqp_hax = u3h(u3t(qp_hax)); // axis
u3_noun pqp_yor = u3h(u3t(qp_yor)); // axis
u3_noun qqp_hax = u3t(u3t(qp_hax)); // (set {type foot})
u3_noun qqp_yor = u3t(u3t(qp_yor)); // (set {type foot})
if ( c3n == u3r_sing(pqp_hax, pqp_yor) ) {
return u3m_error("find-fork-h");
} else {
return
u3nt(c3y,
u3k(pp_hax),
u3nt(c3n, u3k(pqp_hax), u3qdi_uni(qqp_hax, qqp_yor)));
}
}
}
}
}
// error: { return u3m_error("find-fork"); }
}
static u3_noun
_find_buck_fork_twin(u3_noun van, u3_noun wiz)
{
if ( u3_nul == wiz ) {
return u3_nul;
}
else if ( u3_nul == u3t(wiz) ) {
return u3k(u3h(wiz));
}
else {
u3_noun hax = u3k(u3h(wiz));
u3_noun yor = _find_buck_fork_twin(van, u3t(wiz));
u3_noun fid = _find_twin(van, hax, yor);
u3z(hax);
u3z(yor);
return fid;
}
}
static u3_noun
_find_buck_fork_turn(u3_noun van,
u3_noun yed,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
if ( u3_nul == yed ) {
return u3_nul;
}
else {
u3_noun fid = _find_buck(van, u3h(yed), way, p_heg, q_heg, axe, lon, gil);
return u3nc
(fid,
_find_buck_fork_turn
(van, u3t(yed), way, p_heg, q_heg, axe, lon, gil));
}
}
static u3_noun
_find_buck_fork(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
u3_noun p_sut = u3t(sut);
u3_noun yed = u3qdi_tap(p_sut);
u3_noun wiz;
u3_noun ret;
wiz = _find_buck_fork_turn(van, yed, way, p_heg, q_heg, axe, lon, gil);
u3z(yed);
ret = _find_buck_fork_twin(van, wiz);
u3z(wiz);
return ret;
}
static u3_noun
_find_buck_face_next(u3_noun van,
u3_noun sut,
u3_noun q_sut,
u3_noun qp_sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
if ( u3_nul == qp_sut ) {
u3_noun nol = u3nc(u3_nul, u3k(lon));
u3_noun ret = _find_buck(van, q_sut, way, p_heg, q_heg, axe, nol, gil);
u3z(nol);
return ret;
}
else {
u3_noun iqp_sut = u3h(qp_sut); // twig
u3_noun tiv = u3qfu_mint // (pair type nock)
(van, q_sut, c3__noun, iqp_sut);
u3_noun tqp_sut = u3t(qp_sut); // (list twig)
u3_noun p_tiv = u3h(tiv); // type
u3_noun q_tiv = u3t(tiv); // nock
u3_noun fid = _find_buck // pony
(van, p_tiv, way, p_heg, q_heg, 1, u3_nul, u3_nul);
if ( u3_nul == fid ) {
u3z(tiv);
return u3_nul;
}
else if ( (c3n == u3h(fid)) && (c3y == u3h(u3t(fid))) ) {
u3_noun ret;
ret = _find_buck_face_next
(van, sut, q_sut, tqp_sut, way, u3t(u3t(fid)), q_heg, axe, lon, gil);
u3z(fid);
u3z(tiv);
return ret;
}
else {
u3_noun tor; // port
u3_noun vat; // (pair type nock)
u3_noun ret;
u3_noun dog = u3nc(0, u3k(axe)); // nock
u3_noun cob = u3qf_comb(dog, q_tiv);
if ( c3y == u3h(fid) ) {
tor = u3nc(c3y, u3k(u3t(fid)));
} else {
tor = u3nc(c3n, u3k(u3t(u3t(fid))));
}
u3z(fid);
vat = u3qfu_fine(van, sut, tor);
u3z(tor);
ret = u3nt
(c3n,
c3n,
u3nc(u3k(u3h(vat)), u3qf_comb(cob, u3t(vat))));
u3z(vat);
u3z(dog);
u3z(cob);
u3z(tiv);
return ret;
}
}
}
static u3_noun
_find_buck_face(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
u3_noun p_sut, q_sut;
u3x_cell(u3t(sut), &p_sut, &q_sut);
if ( u3_nul == q_heg ) {
return _find_buck_here(van, q_sut, way, p_heg, q_heg, axe, lon, gil);
}
else {
u3_noun uq_heg = u3t(q_heg); // term
if ( c3y == u3ud(p_sut) ) {
if ( c3y == u3r_sing(p_sut, uq_heg) ) {
return _find_buck_here(van, q_sut, way, p_heg, q_heg, axe, lon, gil);
}
else {
return _find_buck_lose(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
}
else {
u3_noun pp_sut = u3h(p_sut); // (map term {wain (unit twig)})
u3_noun qp_sut = u3t(p_sut); // (list (pair type nock))
u3_noun tyr = u3qdb_get(pp_sut, uq_heg); // (unit (unit twig))
if ( u3_nul == tyr ) {
return _find_buck_face_next
(van, sut, q_sut, qp_sut, way, p_heg, q_heg, axe, lon, gil);
}
else {
u3_noun u_tyr = u3t(tyr); // (unit twig)
if ( u3_nul == u_tyr ) {
u3_noun nol = u3nc(u3_nul, u3k(lon));
u3_noun dep = u3qa_inc(p_heg);
u3_noun ret = _find_buck
(van, q_sut, way, dep, q_heg, axe, nol, gil);
u3z(dep);
u3z(nol);
u3z(tyr);
return ret;
}
else {
u3_noun uu_tyr = u3t(u_tyr);
u3_noun tor = u3qfu_fund(van, sut, way, uu_tyr);
if ( c3y == u3h(tor) ) {
u3_noun p_tor = u3t(tor); // (pair vein opal)
u3_noun pp_tor = u3h(p_tor); // vein
u3_noun qp_tor = u3t(p_tor); // opal
u3_noun nol = // vein
u3nt(u3_nul, u3nc(u3_nul, u3k(axe)), u3k(lon));
u3_noun ret;
ret = u3nt(c3y, u3qb_weld(pp_tor, nol), u3k(qp_tor));
u3z(nol);
u3z(tor);
u3z(tyr);
return ret;
}
else {
u3_noun p_tor = u3t(tor); // (pair type nock)
u3_noun pp_tor = u3h(p_tor); // type
u3_noun qp_tor = u3t(p_tor); // nock
u3_noun dog = u3nc(0, u3k(axe)); // nock
u3_noun ret;
ret = u3nt(c3n,
c3n,
u3nc(u3k(pp_tor), u3qf_comb(dog, qp_tor)));
u3z(dog);
u3z(tor);
u3z(tyr);
return ret;
}
}
}
}
}
}
static u3_noun
_find_buck(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun p_heg,
u3_noun q_heg,
u3_noun axe,
u3_noun lon,
u3_noun gil)
{
if ( c3n == u3du(sut) ) switch ( sut ) {
default: return u3m_bail(c3__fail);
case c3__noun: {
// fprintf(stderr, "noun\r\n");
return _find_buck_stop(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
case c3__void: {
// fprintf(stderr, "void\r\n");
// return _find_buck_stop(van, sut, way, p_heg, q_heg, axe, lon, gil);
return u3_nul;
}
}
else switch ( u3h(sut) ) {
default: return u3m_bail(c3__fail);
case c3__atom:
{
// fprintf(stderr, "atom\r\n");
return _find_buck_stop(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
case c3__cell:
{
// fprintf(stderr, "cell\r\n");
return _find_buck_cell(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
case c3__core:
{
// fprintf(stderr, "core\r\n");
return _find_buck_core(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
case c3__hint:
{
u3_noun fop = u3qfu_repo(van, sut);
u3_noun pro = _find_buck(van, fop, way, p_heg, q_heg, axe, lon, gil);
u3z(fop);
return pro;
}
case c3__face:
{
// fprintf(stderr, "face\r\n");
return _find_buck_face(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
case c3__fork:
{
// fprintf(stderr, "fork\r\n");
return _find_buck_fork(van, sut, way, p_heg, q_heg, axe, lon, gil);
}
case c3__hold:
{
// fprintf(stderr, "hold\r\n");
if ( (c3y == u3qdi_has(gil, sut)) ) {
return u3_nul;
}
else {
u3_noun zoc = u3qdi_put(gil, sut);
u3_noun fop = u3qfu_repo(van, sut);
u3_noun pro = _find_buck(van, fop, way, p_heg, q_heg, axe, lon, zoc);
u3z(fop);
u3z(zoc);
return pro;
}
}
}
}
static u3_noun
_find_limb(u3_noun van,
u3_noun sut, // type
u3_noun way, // ?(%read %rite %free %both)
u3_noun i_hyp, // limb
u3_noun p_mor) // palo
{
u3_noun pp_mor = u3h(p_mor); // vein
u3_noun qp_mor = u3t(p_mor); // opal
{
u3_noun ref = u3qfu_felt(qp_mor);
u3_noun lon = u3k(pp_mor);
u3_noun heg = (c3y == u3du(i_hyp))
? u3k(i_hyp)
: u3nq(c3n, 0, u3_nul, u3k(i_hyp));
u3_noun ret;
if ( c3y == u3h(heg) ) {
u3_noun p_heg = u3t(heg); // axis
if ( c3n == u3ud(p_heg) ) {
u3m_p("weird p_heg", p_heg);
return u3m_bail(c3__fail);
}
ret = u3nt
(c3y,
u3nc(u3nc(u3_nul, u3k(p_heg)), u3k(lon)),
u3nc(c3y, u3qfu_peek(van, ref, way, p_heg)));
}
else {
u3_noun p_heg = u3h(u3t(heg)); // @ud
u3_noun q_heg = u3t(u3t(heg)); // (unit term)
ret = _find_buck
(van, ref, way, p_heg, q_heg, 1, lon, u3_nul);
}
u3z(heg);
u3z(lon);
u3z(ref);
return ret;
}
}
static u3_noun
_find_pony(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun hyp)
{
if ( u3_nul == hyp ) {
return u3nt(c3y, u3_nul, u3nc(c3y, u3k(sut)));
}
else {
u3_noun i_hyp = u3h(hyp);
u3_noun t_hyp = u3t(hyp);
u3_noun mor = _find_pony(van, sut, way, t_hyp);
if ( c3n == u3h(mor) ) {
u3_noun p_mor = u3t(mor);
if ( c3y == u3h(p_mor) ) {
return mor;
}
else {
u3_noun pp_mor = u3t(p_mor); // {span nock}
u3_noun ppp_mor = u3h(pp_mor); // span
u3_noun qpp_mor = u3t(pp_mor); // nock
u3_noun gen = u3nt(c3__wing, u3k(i_hyp), u3_nul);
u3_noun fex = u3qfu_mint(van, ppp_mor, c3__noun, gen);
u3_noun ret = u3nt(c3n,
c3n,
u3nc(u3k(u3h(fex)),
u3qf_comb(qpp_mor, u3t(fex))));
u3z(fex);
u3z(gen);
u3z(mor);
return ret;
}
}
else {
u3_noun p_mor = u3t(mor);
u3_noun ret = _find_limb(van, sut, way, i_hyp, p_mor);
u3z(mor);
return ret;
}
}
}
static u3_noun
_cqfu_fond(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun hyp)
{
u3_noun taf;
taf = _find_pony(van, sut, way, hyp);
return taf;
}
static u3_noun
_cqfu_find(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun hyp)
{
u3_noun taf = _find_pony(van, sut, way, hyp);
if ( u3_nul == taf ) {
goto error;
}
else {
if ( c3y == u3h(taf) ) {
u3_noun fat = u3nc(c3y, u3k(u3t(taf)));
u3z(taf);
return fat;
}
else {
if ( c3n == u3h(u3t(taf)) ) {
u3_noun fat = u3nc(c3n, u3k(u3t(u3t(u3t(taf)))));
u3z(taf);
return fat;
}
else {
goto error;
}
}
}
error: {
u3m_p("wing", hyp);
return u3m_error("find");
}
}
/* boilerplate
*/
u3_noun
u3wfu_find(u3_noun cor)
{
u3_noun sut, way, hyp, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &way,
u3x_sam_3, &hyp,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_find(van, sut, way, hyp);
}
}
u3_noun
u3qfu_find(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun hyp)
{
c3_m fun_m = 141 + c3__find + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_3(fun_m, sut, way, hyp);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_find(van, sut, way, hyp);
return u3z_save_3(fun_m, sut, way, hyp, pro);
}
}
/* boilerplate
*/
u3_noun
u3wfu_fond(u3_noun cor)
{
u3_noun sut, way, hyp, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &way,
u3x_sam_3, &hyp,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_fond(van, sut, way, hyp);
}
}
u3_noun
u3qfu_fond(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun hyp)
{
c3_m fun_m = 141 + c3__fond + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_3(fun_m, sut, way, hyp);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_fond(van, sut, way, hyp);
return u3z_save_3(fun_m, sut, way, hyp, pro);
}
}

View File

@ -1,200 +0,0 @@
/* j/6/fire.c
**
*/
#include "all.h"
/* logic
*/
static u3_noun
_fire_vet(u3_noun van)
{
// u3_noun vet = u3j_hook(u3k(van), "vet");
u3_noun vet = u3r_at(u3qfu_van_vet, van);
switch ( vet ) {
case c3n:
case c3y: return vet;
default: return u3m_bail(c3__fail);
}
}
static u3_noun
_fire_mull(u3_noun van,
u3_noun sut,
u3_noun dox,
u3_noun gen)
{
u3_noun rib = u3r_at(u3qfu_van_rib, van);
u3_noun key = u3nt(u3k(sut),
u3k(dox),
u3k(gen));
u3_noun ret;
if ( c3n == _fire_vet(van) ) {
ret = c3y;
}
if ( c3y == u3qdi_has(rib, key) ) {
ret = c3y;
}
else {
u3_noun rob = u3qdi_put(rib, key);
u3_noun von = u3i_molt(u3k(van),
u3qfu_van_rib,
u3k(rob),
0);
u3_noun mul = u3qfu_mull(von, sut, c3__noun, dox, gen);
ret = c3y;
u3z(mul);
u3z(von);
u3z(rob);
}
u3z(key);
return ret;
}
static u3_noun
_fire_each(u3_noun van,
u3_noun vet,
u3_noun typ,
u3_noun gat)
{
u3_noun p_typ, q_typ, pq_typ, qq_typ, rq_typ;
u3_noun ppq_typ, qpq_typ, rpq_typ;
u3_noun h_gat, t_gat;
if ( (c3n == u3du(typ)) || (c3__core != u3h(typ)) ) {
return u3m_error("fire-core");
} else if
( (c3n == u3r_cell(u3t(typ), &p_typ, &q_typ)) ||
(c3n == u3r_trel(q_typ, &pq_typ, &qq_typ, &rq_typ)) ||
(c3n == u3r_trel(pq_typ, &ppq_typ, &qpq_typ, &rpq_typ)) ||
(c3n == u3r_cell(gat, &h_gat, &t_gat)) )
{
return u3m_bail(c3__fail);
} else {
u3_noun dox = u3nt(c3__core,
u3k(qq_typ),
u3nt(u3nt(u3k(ppq_typ), u3k(qpq_typ), c3__gold),
u3k(qq_typ),
u3k(rq_typ)));
if ( (c3__ash == u3h(gat)) || (c3__dry == u3h(gat)) ) {
if ( (c3y == vet) &&
(c3n == u3qfu_nest(van, qq_typ, c3y, p_typ)) )
{
#if 0
u3_noun dun = u3qfu_dunq(van, "need", qq_typ);
u3_noun niz = u3qfu_dunq(van, "have", p_typ);
u3t_push(u3nc(c3__mean, niz));
u3t_push(u3nc(c3__mean, dun));
#endif
return u3m_error("fire-dry");
}
else {
return u3nc(dox, u3k(t_gat));
}
}
else {
c3_assert(c3__wet == u3h(gat));
#if 0
u3_noun dun = u3qfu_dunq(van, "wild", typ);
u3_noun niz = u3qfu_dunq(van, "tame", dox);
u3t_push(u3nc(c3__mean, dun));
u3t_push(u3nc(c3__mean, niz));
#endif
if ( (c3y == vet) &&
(c3n == _fire_mull(van, typ, dox, t_gat)) )
{
return u3m_error("fire-wet");
}
else {
u3z(dox);
#if 0
u3t_drop();
u3t_drop();
#endif
return u3nc(u3k(typ), u3k(t_gat));
}
}
}
}
static u3_noun
_fire_in(u3_noun van,
u3_noun vet,
u3_noun hag)
{
if ( u3_nul == hag ) {
return u3_nul;
}
else {
u3_noun i_hag = u3h(hag);
u3_noun t_hag = u3t(hag);
if ( c3n == u3du(i_hag) ) {
return u3m_bail(c3__fail);
} else {
return u3nc
(_fire_each(van, vet, u3h(i_hag), u3t(i_hag)),
_fire_in(van, vet, t_hag));
}
}
}
static u3_noun
_cqfu_fire(u3_noun van,
u3_noun sut,
u3_noun hag)
{
u3_noun vet = u3r_at(u3qfu_van_vet, van);
c3_assert(!"not live");
{
if ( (c3y == u3du(hag)) && (u3_nul == u3t(hag)) ) {
u3_noun i_hag = u3h(hag);
u3_noun pi_hag = u3h(i_hag);
u3_noun qi_hag = u3t(i_hag);
if ( (c3__wet == u3h(qi_hag)) ) {
u3_noun qqi_hag = u3t(qi_hag);
if ( c3y == u3du(qqi_hag) &&
(u3_nul == u3h(qqi_hag)) &&
(1 == u3t(qqi_hag)) )
{
return u3k(pi_hag);
}
}
}
}
return u3nc(c3__hold, _fire_in(van, vet, hag));
}
/* boilerplate
*/
u3_noun
u3wfu_fire(u3_noun cor)
{
u3_noun sut, hag, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &hag, u3x_con, &van, 0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_fire(van, sut, hag);
}
}
u3_noun
u3qfu_fire(u3_noun van,
u3_noun sut,
u3_noun hag)
{
return _cqfu_fire(van, sut, hag);
}

View File

@ -1,180 +0,0 @@
/* j/6/fish.c
**
*/
#include "all.h"
/* functions
*/
static u3_noun
_fish_in(u3_noun, u3_noun, u3_atom, u3_noun);
static u3_noun
_fish_fork(u3_noun van,
u3_noun p_sut,
u3_atom axe,
u3_noun vit)
{
if ( u3_nul == p_sut ) {
return u3nc(1, 1);
}
else {
u3_noun hed = _fish_in(van, u3h(p_sut), axe, vit);
u3_noun tal = _fish_fork(van, u3t(p_sut), axe, vit);
u3_noun pro = u3qf_flor(hed, tal);
u3z(hed);
u3z(tal);
return pro;
}
}
static u3_noun
_fish_in(u3_noun van,
u3_noun sut,
u3_atom axe,
u3_noun vit)
{
u3_noun p_sut, q_sut;
if ( c3y == u3ud(sut) ) switch ( sut ) {
default: return u3m_bail(c3__fail);
case c3__noun: {
return u3nc(1, 0);
}
case c3__void: {
return u3nc(1, 1);
}
}
else switch ( u3h(sut) ) {
default: return u3m_bail(c3__fail);
case c3__atom: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
if ( c3n == u3du(q_sut) ) {
u3_noun ton = u3nt(3, 0, u3k(axe));
u3_noun pro = u3qf_flip(ton);
u3z(ton);
return pro;
} else {
return u3nt(5,
u3nc(1, u3k(u3t(q_sut))),
u3nc(0, u3k(axe)));
}
}
}
case c3__cell: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
u3_noun hut = u3nt(3, 0, u3k(axe));
u3_noun lef = u3qc_peg(axe, 2);
u3_noun rit = u3qc_peg(axe, 3);
u3_noun hed = _fish_in(van, p_sut, lef, vit);
u3_noun tal = _fish_in(van, q_sut, rit, vit);
u3_noun hob = u3qf_flan(hed, tal);
u3_noun vug = u3qf_flan(hut, hob);
u3z(hob);
u3z(tal);
u3z(hed);
u3z(rit);
u3z(lef);
u3z(hut);
return vug;
}
}
case c3__core: {
return u3m_error("fish-core");
}
case c3__hint:
case c3__face: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
return _fish_in(van, q_sut, axe, vit);
}
}
case c3__fork: p_sut = u3t(sut);
{
u3_noun yed = u3qdi_tap(p_sut);
u3_noun ret = _fish_fork(van, yed, axe, vit);
u3z(yed);
return ret;
}
case c3__hold: {
p_sut = u3t(sut);
{
if ( (c3y == u3qdi_has(vit, sut)) ) {
// u3_noun dun = u3qfu_dunq(van, "type", sut);
u3_noun niz = u3qfu_shep
(van, "axis", 'd', u3k(axe));
// u3t_push(u3nc(c3__mean, dun));
u3t_push(u3nc(c3__mean, niz));
return u3m_error("fish-loop");
} else {
u3_noun zoc = u3qdi_put(vit, sut);
u3_noun fop = u3qfu_repo(van, sut);
u3_noun pro = _fish_in(van, fop, axe, zoc);
u3z(fop);
u3z(zoc);
return pro;
}
}
}
}
}
static u3_noun
_cqfu_fish(u3_noun van,
u3_noun sut,
u3_atom axe)
{
return _fish_in(van, sut, axe, u3_nul);
}
/* boilerplate
*/
u3_noun
u3wfu_fish(u3_noun cor)
{
u3_noun sut, axe, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &axe, u3x_con, &van, 0)) ||
(c3n == u3ud(axe)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_fish(van, sut, axe);
}
}
u3_noun
u3qfu_fish(u3_noun van,
u3_noun sut,
u3_noun axe)
{
c3_m fun_m = 141 + c3__fish + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, axe);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_fish(van, sut, axe);
return u3z_save_2(fun_m, sut, axe, pro);
}
}

View File

@ -1,215 +0,0 @@
/* j/6/fuse.c
**
*/
#include "all.h"
/* logic
*/
static u3_noun
_fuse_in(u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_fuse_repo(u3_noun van,
u3_noun sut,
u3_noun ref,
u3_noun bix)
{
u3_noun rep = u3qfu_repo(van, sut);
u3_noun ret = _fuse_in(van, rep, ref, bix);
if ( c3y == u3r_sing(ret, rep) ) {
if ( c3__void == rep ) {
return c3__void;
} else {
u3z(rep);
u3z(ret);
return u3k(sut);
}
} else {
u3z(rep);
return ret;
}
}
static u3_noun
_fuse_in_fork(u3_noun van, u3_noun p_sut, u3_noun ref, u3_noun bix)
{
if ( u3_nul == p_sut ) {
return u3_nul;
}
else {
return u3nc(_fuse_in(van, u3h(p_sut), ref, bix),
_fuse_in_fork(van, u3t(p_sut), ref, bix));
}
}
static u3_noun
_fuse_in(u3_noun van,
u3_noun sut,
u3_noun ref,
u3_noun bix)
{
u3_noun p_sut, q_sut;
if ( c3y == u3r_sing(sut, ref) || (c3__noun == ref) ) {
return u3k(sut);
}
if ( c3n == u3du(sut) ) switch ( sut ) {
default: return u3m_bail(c3__fail);
case c3__noun:
{
return u3k(ref);
}
case c3__void:
{
return c3__void;
}
}
else switch ( u3h(sut) ) {
default: return u3m_bail(c3__fail);
case c3__atom: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
if ( c3y == u3du(ref) ) {
if ( c3__atom == u3h(ref) ) {
u3_noun p_ref, q_ref;
u3x_cell(u3t(ref), &p_ref, &q_ref);
{
u3_noun foc = (c3y == u3qf_fitz(p_ref, p_sut))
? u3k(p_sut)
: u3k(p_ref);
if ( c3y == u3du(q_sut) ) {
if ( c3y == u3du(q_ref) ) {
if ( c3y == u3r_sing(q_ref, q_sut) ) {
return u3nt(c3__atom, foc, u3k(q_sut));
}
else {
u3z(foc);
return c3__void;
}
}
else {
return u3nt(c3__atom, foc, u3k(q_sut));
}
} else {
return u3nt(c3__atom, foc, u3k(q_ref));
}
}
}
else if ( c3__cell == u3h(ref) ) {
return c3__void;
}
}
return _fuse_in(van, ref, sut, bix);
}
case c3__cell: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun p_ref, q_ref;
if ( c3y == u3r_pq(ref, c3__cell, &p_ref, &q_ref) ) {
u3_noun hed = _fuse_in(van, p_sut, p_ref, bix);
u3_noun tal = _fuse_in(van, q_sut, q_ref, bix);
u3_noun ret = u3qf_cell(hed, tal);
u3z(hed);
u3z(tal);
return ret;
}
else return _fuse_in(van, ref, sut, bix);
}
case c3__core:
{
return _fuse_repo(van, sut, ref, bix);
}
case c3__hint: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun vot = _fuse_in(van, q_sut, ref, bix);
u3_noun ret = u3qf_hint(p_sut, vot);
u3z(vot);
return ret;
}
case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun vot = _fuse_in(van, q_sut, ref, bix);
u3_noun ret = u3qf_face(p_sut, vot);
u3z(vot);
return ret;
}
case c3__fork: p_sut = u3t(sut);
{
u3_noun yed = u3qdi_tap(p_sut);
u3_noun ret = u3kf_fork(_fuse_in_fork(van, yed, ref, bix));
u3z(yed);
return ret;
}
case c3__hold:
{
u3_noun hud = u3nc(u3k(sut), u3k(ref));
if ( c3y == u3qdi_has(bix, hud) ) {
// u3_noun dun = u3qfu_dunq(van, "type", sut);
// u3_noun niz = u3qfu_dunq(van, "over", ref);
// u3t_push(u3nc(c3__mean, dun));
// u3t_push(u3nc(c3__mean, niz));
return u3m_error("fuse-loop");
} else {
u3_noun bux = u3qdi_put(bix, hud);
u3_noun ret = _fuse_repo(van, sut, ref, bux);
u3z(hud);
u3z(bux);
return ret;
}
}
}
}
static u3_noun
_cqfu_fuse(u3_noun van,
u3_noun sut,
u3_noun ref)
{
return _fuse_in(van, sut, ref, u3_nul);
}
/* boilerplate
*/
u3_noun
u3wfu_fuse(u3_noun cor)
{
u3_noun sut, ref, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &ref, u3x_con, &van, 0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_fuse(van, sut, ref);
}
}
u3_noun
u3qfu_fuse(u3_noun van,
u3_noun sut,
u3_noun ref)
{
c3_m fun_m = 141 + c3__fuse + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, ref);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_fuse(van, sut, ref);
return u3z_save_2(fun_m, sut, ref, pro);
}
}

View File

@ -1,16 +0,0 @@
/* j/6/gain.c
**
*/
#include "all.h"
u3_noun
u3qfu_gain(u3_noun van,
u3_noun sut,
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("u3qfu_gain-gain", von, "gain");
return u3n_kick_on(u3i_molt(gat, u3x_sam, u3k(gen), 0));
}

View File

@ -1,16 +0,0 @@
/* j/6/lose.c
**
*/
#include "all.h"
u3_noun
u3qfu_lose(u3_noun van,
u3_noun sut,
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("u3qfu_lose-lose", von, "lose");
return u3n_kick_on(u3i_molt(gat, u3x_sam, u3k(gen), 0));
}

View File

@ -1,904 +0,0 @@
/* j/6/mint.c
**
*/
#include "all.h"
/* logic
*/
static u3_noun
_mint_in(u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_mint_bean()
{
return u3kf_fork(u3nt(u3nq(c3__atom, 'f', u3_nul, 0),
u3nq(c3__atom, 'f', u3_nul, 1),
u3_nul));
}
static u3_noun
_mint_tend(u3_noun vit)
{
if ( u3_nul == vit ) {
return 1;
} else {
u3_noun nex = _mint_tend(u3t(vit));
if ( u3_nul == u3h(vit) ) {
return nex;
} else {
u3_noun boy = u3qc_peg(u3t(u3h(vit)), nex);
u3z(nex);
return boy;
}
}
}
static u3_noun
_mint_vet(u3_noun van)
{
// u3_noun vet = u3j_hook(u3k(van), "vet");
u3_noun vet = u3r_at(u3qfu_van_vet, van);
switch ( vet ) {
case c3n:
case c3y: return vet;
default: return u3m_bail(c3__fail);
}
}
static u3_noun
_mint_feel(u3_noun van,
u3_noun sut,
u3_noun rot)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "feel");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(rot),
0));
}
static u3_noun
_mint_mine(u3_noun van,
u3_noun sut,
u3_noun mel,
u3_noun nym,
u3_noun hud,
u3_noun dom)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "mine");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(mel),
u3x_sam_6,
u3k(nym),
u3x_sam_14,
u3k(hud),
u3x_sam_15,
u3k(dom),
0));
}
static u3_noun
_mint_burp(u3_noun van,
u3_noun sut)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
return u3j_hook(von, "burp");
}
static u3_noun
_mint_cond(u3_noun pex,
u3_noun yom,
u3_noun woq)
{
if ( 1 == u3h(pex) ) {
if ( 0 == u3t(pex) ) {
u3z(pex);
u3z(woq);
return yom;
}
else if ( 1 == u3t(pex) ) {
u3z(pex);
u3z(yom);
return woq;
}
}
return u3nq(6, pex, yom, woq);
}
static u3_noun
_mint_corn(u3_noun van,
u3_noun sut,
u3_noun gen)
{
u3_noun mil = _mint_in(van, sut, c3__noun, gen);
u3_noun fol = u3k(u3t(mil));
u3z(mil);
return fol;
}
static u3_noun
_mint_nice(u3_noun van,
u3_noun gol,
u3_noun typ)
{
if ( (c3y == _mint_vet(van)) &&
(c3n == u3qfu_nest(van, gol, c3y, typ)) )
{
// u3_noun dun = u3qfu_dunq(van, "need", gol);
// u3_noun niz = u3qfu_dunq(van, "have", typ);
// u3t_push(u3nc(c3__mean, dun));
// u3t_push(u3nc(c3__mean, niz));
return u3m_error("mint-nice");
}
else return typ;
}
static u3_noun
_mint_cove(u3_noun nug)
{
if ( 0 == u3h(nug) ) {
return u3k(u3t(nug));
}
else if ( 11 == u3h(nug) ) {
return _mint_cove(u3t(u3t(nug)));
}
else {
return u3m_error("mint-cove");
}
}
static u3_noun
_mint_grow(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_atom mel,
u3_noun nym,
u3_noun hud,
u3_noun ruf,
u3_noun dom)
{
u3_noun dan = _mint_in(van, sut, c3__noun, ruf);
u3_noun p_dan = u3h(dan);
u3_noun q_dan = u3t(dan);
u3_noun pul = _mint_mine(van, p_dan, mel, nym, hud, dom);
u3_noun ret = u3nc(_mint_nice(van, gol, u3k(u3h(pul))),
u3qf_cons(u3t(pul), q_dan));
u3z(pul);
u3z(dan);
return ret;
}
static u3_noun
_mint_loc(u3_noun van,
u3_noun loc)
{
u3_noun mol = u3nc('o', u3k(loc));
u3_noun sho = u3j_cook("_mint_loc-show", u3k(van), "show");
u3_noun ret = u3i_molt(u3k(sho), u3x_sam, u3k(mol), 0);
u3z(mol);
u3z(sho);
return ret;
}
#if 1
static u3_noun
_mint_cnts(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun hyp,
u3_noun rig)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("_mint_cnts-emin", von, "emin");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(gol),
u3x_sam_6,
u3k(hyp),
u3x_sam_7,
u3k(rig),
0));
}
#else
static u3_noun
_mint_edit(u3_noun van,
u3_noun sut,
u3_noun mew,
u3_noun p_lar,
u3_noun rag,
u3_noun hej)
{
while ( 1 ) {
if ( c3n == u3du(mew) ) {
u3_noun gim = u3qfu_fire(van, sut, rag);
u3_noun fol = u3qf_hike(p_lar, hej);
u3z(rag);
u3z(hej);
return u3nc(gim, fol);
} else {
u3_noun i_mew = u3h(mew);
u3_noun t_mew = u3t(mew);
u3_noun pi_mew = u3h(i_mew);
u3_noun qi_mew = u3t(i_mew);
u3_noun zil = u3qfu_mint(van, sut, c3__noun, qi_mew);
u3_noun p_zil = u3h(zil);
u3_noun q_zil = u3t(zil);
u3_noun wip = u3qfu_toss(van, sut, pi_mew, p_zil, rag);
u3z(rag);
rag = u3k(u3t(wip));
hej = u3nc(u3nc(u3k(u3h(wip)),
u3k(q_zil)),
hej);
u3z(zil);
u3z(wip);
mew = t_mew;
}
}
}
static u3_noun
_mint_cnts_old(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun hyp,
u3_noun rig)
{
u3_noun lar = u3qfu_seek(van, sut, c3__read, hyp);
u3_noun p_lar = u3h(lar);
u3_noun q_lar = u3t(lar);
u3_noun pq_lar = u3h(q_lar);
u3_noun qq_lar = u3t(q_lar);
u3_noun mew = rig;
u3_noun yom = _mint_edit(van, sut, mew, p_lar, u3k(qq_lar), u3_nul);
u3_noun p_yom = u3h(yom);
u3_noun q_yom = u3t(yom);
u3_noun ret = u3nc(_mint_nice(van, gol, u3k(p_yom)),
(0 == pq_lar) ? u3k(q_yom)
: u3nt(9, u3k(pq_lar), u3k(q_yom)));
u3z(yom);
u3z(lar);
return ret;
}
#endif
# define _mint_used()
static u3_noun
_mint_in(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun gen)
{
u3_noun p_gen, q_gen, r_gen;
u3_noun ret;
if ( (c3__void == sut) &&
!((c3y == u3du(gen)) && (c3__dbug == u3h(gen))) )
{
if ( (c3n == _mint_vet(van))
|| ((c3y == u3du(gen)) &&
((c3__zpfs == u3h(gen)) ||
(c3__zpsk == u3h(gen)) ||
(c3__lost == u3h(gen)) ||
(c3__fail == u3h(gen)) ||
(c3__zpzp == u3h(gen)))) )
{
return u3nt(c3__void, 0, 0);
}
else {
return u3m_error("mint-vain");
}
}
if ( c3n == u3du(gen) ) {
u3_noun ter = u3r_at(u3x_con_3, van);
u3_noun fab = u3r_at(u3qfu_van_fab, van);
u3_noun rex = u3qfp_open(ter, fab, gen);
ret = _mint_in(van, sut, gol, rex);
u3z(rex);
return ret;
}
else if ( c3y == u3du(u3h(gen)) ) {
_mint_used();
{
u3_noun hed = _mint_in(van, sut, c3__noun, u3h(gen));
u3_noun tal = _mint_in(van, sut, c3__noun, u3t(gen));
u3_noun typ = u3qf_cell(u3h(hed), u3h(tal));
ret = u3nc(_mint_nice(van, gol, typ),
u3qf_cons(u3t(hed),
u3t(tal)));
u3z(hed);
u3z(tal);
return ret;
}
} else switch ( u3h(gen) ) {
default: {
u3_noun ter = u3r_at(u3x_con_3, van);
u3_noun fab = u3r_at(u3qfu_van_fab, van);
u3_noun rex = u3qfp_open(ter, fab, gen);
if ( c3y == u3r_sing(rex, gen) ) {
#if 1
u3_noun zix = u3qfu_shep(van, "gene", 'q', u3k(gen));
u3t_push(u3nc(c3__mean, zix));
return u3m_error("mint-open");
#else
u3_err("h", u3h(gen));
return u3m_bail(c3__fail);
#endif
}
ret = _mint_in(van, sut, gol, rex);
u3z(rex);
return ret;
}
case c3__fits: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun wam = u3qfu_play(van, sut, p_gen);
u3_noun dok = u3nc(c3__wing, u3k(q_gen));
u3_noun vol = _mint_corn(van, sut, dok);
u3_noun axe = _mint_cove(vol);
ret = u3nc(_mint_nice(van, gol, _mint_bean()),
u3qfu_fish(van, wam, axe));
u3z(axe);
u3z(vol);
u3z(wam);
u3z(dok);
return ret;
}
case c3__wtcl: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_mint_used();
{
u3_noun bol = _mint_bean();
u3_noun nor = _mint_in(van, sut, bol, p_gen);
u3_noun fex = u3qfu_gain(van, sut, p_gen);
u3_noun wux = u3qfu_lose(van, sut, p_gen);
u3_noun duy = (c3__void == fex)
? ( (c3__void == wux)
? u3nc(0, 0)
: u3nc(1, 1) )
: ( (c3__void == wux)
? u3nc(1, 0)
: u3k(u3t(nor)) );
u3_noun hiq = _mint_in(van, fex, gol, q_gen);
u3_noun ran = _mint_in(van, wux, gol, r_gen);
ret = u3nc(u3qf_forq(u3h(hiq),
u3h(ran)),
_mint_cond(duy,
u3k(u3t(hiq)),
u3k(u3t(ran))));
u3z(ran);
u3z(hiq);
u3z(nor);
u3z(wux);
u3z(fex);
u3z(bol);
return ret;
}
case c3__clhp: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun hed = _mint_in(van, sut, c3__noun, p_gen);
u3_noun tal = _mint_in(van, sut, c3__noun, q_gen);
u3_noun typ = u3qf_cell(u3h(hed), u3h(tal));
ret = u3nc(_mint_nice(van, gol, typ),
u3qf_cons(u3t(hed),
u3t(tal)));
u3z(hed);
u3z(tal);
return ret;
}
case c3__dtts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun typ = _mint_nice(van, gol, _mint_bean());
u3_noun one = _mint_in(van, sut, c3__noun, p_gen);
u3_noun two = _mint_in(van, sut, c3__noun, q_gen);
u3_noun ret;
if ( (c3y == _mint_vet(van)) &&
(c3n == u3qfu_nest(van, u3h(one), c3n, u3h(two))) &&
(c3n == u3qfu_nest(van, u3h(two), c3y, u3h(one))) )
{
return u3m_error("nest");
}
ret = u3nc(typ, u3nt(5, u3k(u3t(one)), u3k(u3t(two))));
u3z(one);
u3z(two);
return ret;
}
case c3__dtwt: p_gen = u3t(gen);
_mint_used();
{
u3_noun typ = _mint_nice(van, gol, _mint_bean());
return u3nc(typ,
u3nc(3, _mint_corn(van, sut, p_gen)));
}
case c3__dtkt: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun nog = u3nc(c3__kttr, u3k(p_gen));
u3_noun nef = _mint_in(van, sut, gol, nog);
u3_noun viz = _mint_in(van, sut, c3__noun, q_gen);
ret = u3nc(u3k(u3h(nef)),
u3nt(12, u3nc(1, u3nc(151, u3k(u3h(nef)))), u3k(u3t(viz))));
u3z(viz);
u3z(nef);
u3z(nog);
return ret;
}
case c3__dtls: p_gen = u3t(gen);
_mint_used();
{
u3_noun tom = u3nt(c3__atom, u3_blip, u3_nul);
u3_noun sam = _mint_in(van, sut, tom, p_gen);
ret = u3nc(_mint_nice(van, gol, tom),
u3nc(4, u3k(u3t(sam))));
u3z(sam);
return ret;
}
case c3__rock: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun typ = u3qfu_play(van, sut, gen);
u3_noun ret = u3nc(_mint_nice(van, gol, typ),
u3nc(1, u3k(q_gen)));
return ret;
}
case c3__dttr: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun one = _mint_corn(van, sut, p_gen);
u3_noun two = _mint_corn(van, sut, q_gen);
return u3nc(_mint_nice(van, gol, c3__noun),
u3nt(2, one, two));
}
case c3__sand: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun typ = u3qfu_play(van, sut, gen);
u3_noun ret = u3nc(_mint_nice(van, gol, typ),
u3nc(1, u3k(q_gen)));
return ret;
}
case c3__hand:
_mint_used();
{
return u3k(u3t(gen));
}
case c3__ktbr: p_gen = u3t(gen);
_mint_used();
{
u3_noun ryd = _mint_in(van, sut, gol, p_gen);
u3_noun tyf = u3qfu_wrap(van, u3h(ryd), c3__iron);
u3_noun tyn = _mint_nice(van, gol, tyf);
u3_noun pro = u3nc(tyn, u3k(u3t(ryd)));
u3z(ryd);
return pro;
}
case c3__ktpd:
case c3__ktpm: p_gen = u3t(gen);
_mint_used();
{
u3_noun ryd = _mint_in(van, sut, gol, p_gen);
u3_noun tyf = u3qfu_wrap(van, u3h(ryd), c3__zinc);
u3_noun tyn = _mint_nice(van, gol, tyf);
u3_noun pro = u3nc(tyn, u3k(u3t(ryd)));
u3z(ryd);
return pro;
}
case c3__ktwt: p_gen = u3t(gen);
_mint_used();
{
u3_noun ryd = _mint_in(van, sut, gol, p_gen);
u3_noun tyf = u3qfu_wrap(van, u3h(ryd), c3__lead);
u3_noun tyn = _mint_nice(van, gol, tyf);
u3_noun pro = u3nc(tyn, u3k(u3t(ryd)));
u3z(ryd);
return pro;
}
case c3__note: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun hit = u3nc(u3k(sut), u3k(p_gen));
u3_noun hum = _mint_in(van, sut, gol, q_gen);
u3_noun ret = u3nc(u3qf_hint(hit, u3h(hum)),
u3k(u3t(hum)));
u3z(hum);
u3z(hit);
return ret;
}
case c3__tune: p_gen = u3t(gen);
_mint_used();
{
return u3nc(u3qf_face(p_gen, sut), u3nc(0, 1));
}
case c3__ktls: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun huz = u3qfu_play(van, sut, p_gen);
u3_noun hif = _mint_nice(van, gol, huz);
u3_noun zel = _mint_in(van, sut, hif, q_gen);
u3_noun ret = u3nc(hif, u3k(u3t(zel)));
u3z(zel);
return ret;
}
case c3__tsbn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun fid = _mint_in(van, sut, c3__noun, p_gen);
u3_noun p_fid = u3h(fid);
u3_noun q_fid = u3t(fid);
if ( 0 == p_fid ) {
u3m_p("bad subject: p_gen", p_gen);
c3_assert(0);
}
u3_noun dov = _mint_in(van, p_fid, gol, q_gen);
u3_noun p_dov = u3h(dov);
u3_noun q_dov = u3t(dov);
ret = u3nc(u3k(p_dov),
u3qf_comb(q_fid, q_dov));
u3z(fid);
u3z(dov);
return ret;
}
case c3__tscm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun boc = u3qfu_busk(van, sut, p_gen);
u3_noun ret = _mint_in(van, boc, gol, q_gen);
u3z(boc);
return ret;
}
case c3__cnts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
return _mint_cnts(van, sut, gol, p_gen, q_gen);
}
case c3__brcn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
ret = _mint_grow(van, sut, gol, c3__gold, p_gen, c3__dry, ruf, q_gen);
u3z(ruf);
return ret;
}
case c3__brvt: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
ret = _mint_grow(van, sut, gol, c3__gold, p_gen, c3__wet, ruf, q_gen);
u3z(ruf);
return ret;
}
case c3__sgzp: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun typ = u3qfu_play(van, sut, p_gen);
u3_noun dug = u3qfu_duck(van, typ);
u3t_push(u3nc(c3__mean, dug));
{
ret = _mint_in(van, sut, gol, q_gen);
}
u3t_drop();
u3z(typ);
return ret;
}
case c3__sgbn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun hum = _mint_in(van, sut, gol, q_gen);
u3_noun bez;
if ( c3y == u3ud(p_gen) ) {
bez = u3k(p_gen);
} else {
bez = u3nc(u3k(u3h(p_gen)),
_mint_corn(van, sut, u3t(p_gen)));
}
ret = u3nc(u3k(u3h(hum)),
u3nt(11, bez, u3k(u3t(hum))));
u3z(hum);
return ret;
}
case c3__zpts: p_gen = u3t(gen);
_mint_used();
{
u3_noun von = u3i_molt(u3k(van), u3qfu_van_vet, c3n, 0);
u3_noun sev = _mint_corn(von, sut, p_gen);
u3z(von);
return u3nc(c3__noun, u3nc(1, sev));
}
case c3__ktcn: p_gen = u3t(gen);
_mint_used();
{
u3_noun von = u3i_molt(u3k(van), u3qfu_van_fab, c3n, 0);
u3_noun ret = _mint_in(von, sut, gol, p_gen);
u3z(von);
return ret;
}
case c3__wthx: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun hyp = u3nc(u3nc(c3y, 1), u3k(q_gen));
u3_noun fid = u3qfu_find(van, sut, c3__free, hyp);
if ( c3y != u3h(fid) ) {
return u3m_error("mint-fragment");
}
else {
u3_noun pp_fid = u3h(u3t(fid));
u3_noun qp_fid = u3t(u3t(fid));
if ( c3y != u3h(qp_fid) ) {
return u3m_error("mint-fragment");
}
else {
u3_noun pqp_fid = u3t(qp_fid);
u3_noun axe = _mint_tend(pp_fid);
u3_noun ret;
ret = u3nc(_mint_nice(van, gol, _mint_bean()),
u3qfr_fish(van, pqp_fid, p_gen, axe));
u3z(axe);
u3z(fid);
u3z(hyp);
return ret;
}
}
}
case c3__cold:
case c3__ktsg: p_gen = u3t(gen);
_mint_used();
{
c3_m fun_m = 141 + c3__blow;
u3_noun vrf = u3r_at(u3qfu_van_vrf, van);
u3_noun pro = u3z_find_4(fun_m, vrf, sut, gol, p_gen);
if ( u3_none != pro ) {
return pro;
}
else {
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("_mint_in-blow", von, "blow");
u3_noun pro;
pro = u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(gol),
u3x_sam_3,
u3k(p_gen),
0));
return u3z_save_4(fun_m, vrf, sut, gol, p_gen, pro);
}
}
case c3__zpcm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
return u3nc(_mint_nice(van,
gol,
u3qfu_play(van, sut, p_gen)),
u3nc(1, u3k(q_gen)));
}
case c3__dbug: u3x_cell(u3t(gen), &p_gen, &q_gen);
{
u3t_push(u3nc(c3__mean, _mint_loc(van, p_gen)));
{
u3_noun hum = _mint_in(van, sut, gol, q_gen);
u3_noun bez = u3nt(c3__spot, 1, u3k(p_gen));
ret = u3nc(u3k(u3h(hum)), u3nt(11, bez, u3k(u3t(hum))));
u3z(hum);
}
u3t_drop();
return ret;
}
case c3__zpmc:
case c3__zpsm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun vos = _mint_in(van, sut, c3__noun, q_gen);
u3_noun zur = u3qfu_play(van, sut, p_gen);
u3_noun p_vos = u3h(vos);
u3_noun q_vos = u3t(vos);
u3_noun waz = u3nc(1, _mint_burp(van, p_vos));
// u3_noun waz = u3nc(1, u3k(p_vos));
u3_noun sif = u3k(zur);
u3_noun cig = u3qf_cell(sif, p_vos);
u3_noun ret;
ret = u3nc(_mint_nice(van, gol, cig),
u3qf_cons(waz, q_vos));
u3z(waz);
u3z(zur);
u3z(sif);
u3z(vos);
return ret;
}
case c3__zpvt: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_mint_used();
{
if ( c3y == _mint_feel(van, sut, p_gen) ) {
return _mint_in(van, sut, gol, q_gen);
} else {
return _mint_in(van, sut, gol, r_gen);
}
}
case c3__lost: p_gen = u3t(gen);
_mint_used();
{
if ( c3y == _mint_vet(van) ) {
u3_noun zur = u3qfu_play(van, sut, p_gen);
u3_noun dun = u3qfu_dunq(van, "lost", zur);
u3t_push(u3nc(c3__mean, dun));
return u3m_error("mint-lost");
}
else {
return u3nt(c3__void, 0, 0);
}
}
case c3__fail:
case c3__zpzp:
_mint_used();
{
return u3nt(c3__void, 0, 0);
}
}
}
static u3_noun
_cqfu_mint(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun gen)
{
return _mint_in(van, sut, gol, gen);
}
/* boilerplate
*/
u3_noun
u3wfu_mint(u3_noun cor)
{
u3_noun sut, gol, gen, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &gol,
u3x_sam_3, &gen,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_mint(van, sut, gol, gen);
}
}
u3_noun
u3qfu_mint(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun gen)
{
c3_m fun_m = 141 + c3__mint;
u3_noun vrf = u3r_at(u3qfu_van_vrf, van);
u3_noun pro = u3z_find_4(fun_m, vrf, sut, gol, gen);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_mint(van, sut, gol, gen);
return u3z_save_4(fun_m, vrf, sut, gol, gen, pro);
}
}

View File

@ -1,852 +0,0 @@
/* j/6/mull.c
**
*/
#include "all.h"
/* functions
*/
static u3_noun
_mull_in(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_mull_bean()
{
return u3kf_fork(u3nt(u3nq(c3__atom, 'f', u3_nul, 0),
u3nq(c3__atom, 'f', u3_nul, 1),
u3_nul));
}
static u3_noun
_mull_loc(u3_noun van,
u3_noun loc)
{
u3_noun mol = u3nc('o', u3k(loc));
u3_noun sho = u3j_cook("_mull_loc-show", u3k(van), "show");
u3_noun ret = u3i_molt(u3k(sho), u3x_sam, u3k(mol), 0);
u3z(mol);
u3z(sho);
return ret;
}
static u3_noun
_mull_feel(u3_noun van,
u3_noun sut,
u3_noun rot)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "feel");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(rot),
0));
}
static u3_noun
_mull_tend(u3_noun vit)
{
if ( u3_nul == vit ) {
return 1;
} else {
u3_noun nex = _mull_tend(u3t(vit));
if ( u3_nul == u3h(vit) ) {
return nex;
} else {
u3_noun boy = u3qc_peg(u3t(u3h(vit)), nex);
u3z(nex);
return boy;
}
}
}
static u3_noun
_mull_cove(u3_noun nug)
{
if ( 0 == u3h(nug) ) {
return u3k(u3t(nug));
}
else if ( 11 == u3h(nug) ) {
return _mull_cove(u3t(u3t(nug)));
}
else {
return u3m_error("mull-cove");
}
}
static u3_noun
_mull_mile(u3_noun van,
u3_noun sut,
u3_noun dox,
u3_noun mel,
u3_noun nym,
u3_noun hud,
u3_noun dom)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "mile");
// fprintf(stderr, "mile\r\n");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(dox),
u3x_sam_6,
u3k(mel),
u3x_sam_14,
u3k(nym),
u3x_sam_30,
u3k(hud),
u3x_sam_31,
u3k(dom),
0));
}
static u3_noun
_mull_doke(u3_noun van,
u3_noun sut,
u3_noun gen)
{
u3_noun fug = u3qfu_mint(van, sut, c3__noun, gen);
u3_noun axe = _mull_cove(u3t(fug));
u3z(fug);
return axe;
}
static u3_noun
_mull_nice(u3_noun van,
u3_noun gol,
u3_noun typ)
{
if ( c3n == u3qfu_nest(van, gol, c3y, typ) ) {
// u3_noun dun = u3qfu_dunq(van, "need", gol);
// u3_noun niz = u3qfu_dunq(van, "have", typ);
// u3t_push(u3nc(c3__mean, dun));
// u3t_push(u3nc(c3__mean, niz));
return u3m_error("mull-nice");
}
else return typ;
}
static u3_noun
_mull_grow(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_atom mel,
u3_noun nym,
u3_noun hud,
u3_noun ruf,
u3_noun dom)
{
u3_noun dan = _mull_in(van, sut, c3__noun, dox, ruf);
u3_noun p_dan = u3h(dan);
u3_noun q_dan = u3t(dan);
u3_noun yaz = _mull_mile(van, p_dan, q_dan, mel, nym, hud, dom);
u3_noun p_yaz = u3h(yaz);
u3_noun q_yaz = u3t(yaz);
u3_noun ret = u3nc(_mull_nice(van, gol, u3k(p_yaz)), u3k(q_yaz));
u3z(yaz);
u3z(dan);
return ret;
}
static u3_noun
_mull_both(u3_noun van,
u3_noun gol,
u3_noun typ)
{
return u3nc(_mull_nice(van, gol, u3k(typ)),
typ);
}
#if 1
static u3_noun
_mull_cnts(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_noun hyp,
u3_noun rig)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("_mull_cnts-emul", von, "emul");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(gol),
u3x_sam_6,
u3k(dox),
u3x_sam_14,
u3k(hyp),
u3x_sam_15,
u3k(rig),
0));
}
#else
static u3_noun
_mull_edit(u3_noun van,
u3_noun sut,
u3_noun dox,
u3_noun mew,
u3_noun p_yom,
u3_noun q_yom)
{
while ( 1 ) {
if ( c3n == u3du(mew) ) {
return u3nc(p_yom, q_yom);
} else {
u3_noun i_mew = u3h(mew);
u3_noun t_mew = u3t(mew);
u3_noun pi_mew = u3h(i_mew);
u3_noun qi_mew = u3t(i_mew);
u3_noun zil = _mull_in(van, sut, c3__noun, dox, qi_mew);
u3_noun p_zil = u3h(zil);
u3_noun q_zil = u3t(zil);
u3_noun cuf = u3qfu_toss(van, sut, pi_mew, p_zil, p_yom);
u3_noun dof = u3qfu_toss(van, sut, pi_mew, q_zil, q_yom);
if ( u3r_sing(u3h(cuf), u3h(dof)) ) {
u3m_error("mull-bonk-a");
}
u3z(p_yom);
p_yom = u3k(u3t(cuf));
u3z(q_yom);
q_yom = u3k(u3t(dof));
u3z(dof);
u3z(cuf);
u3z(zil);
mew = t_mew;
}
}
}
static u3_noun
_mull_cnts_old(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_noun hyp,
u3_noun rig)
{
u3_noun lar = u3qfu_seek(van, sut, c3__read, hyp);
u3_noun vug = u3qfu_seek(van, dox, c3__read, hyp);
u3_noun p_lar = u3h(lar);
u3_noun q_lar = u3t(lar);
u3_noun pq_lar = u3h(q_lar);
u3_noun qq_lar = u3t(q_lar);
u3_noun p_vug = u3h(vug);
u3_noun q_vug = u3t(vug);
u3_noun pq_vug = u3h(q_vug);
u3_noun qq_vug = u3t(q_vug);
if ( c3a(u3r_sing(p_lar, p_vug), u3r_sing(pq_lar, pq_vug)) ) {
u3m_error("mull-bonk-e");
}
{
u3_noun mew = rig;
u3_noun yom = _mull_edit
(van, sut, dox, mew, u3k(qq_lar),
u3k(qq_vug));
u3_noun von = u3i_molt(u3k(van), u3qfu_van_vet, c3n, 0);
u3_noun p_ret = u3qfu_fire(van, sut, u3h(yom));
u3_noun q_ret = u3qfu_fire(von, sut, u3t(yom));
u3z(von);
u3z(yom);
u3z(vug);
u3z(lar);
return u3nc(_mull_nice(van, gol, p_ret), q_ret);
}
}
#endif
# define _mull_used()
static u3_noun
_mull_in(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_noun gen)
{
u3_noun p_gen, q_gen, r_gen;
u3_noun ret;
if ( c3n == u3du(gen) ) {
u3_noun ter = u3r_at(u3x_con_3, van);
u3_noun fab = u3r_at(u3qfu_van_fab, van);
u3_noun rex = u3qfp_open(ter, fab, gen);
ret = _mull_in(van, sut, gol, dox, rex);
u3z(rex);
return ret;
}
else if ( c3y == u3du(u3h(gen)) ) {
_mull_used();
{
u3_noun hed = _mull_in(van, sut, c3__noun, dox, u3h(gen));
u3_noun tal = _mull_in(van, sut, c3__noun, dox, u3t(gen));
u3_noun dis = u3qf_cell(u3h(hed), u3h(tal));
u3_noun dat = u3qf_cell(u3t(hed), u3t(tal));
u3_noun ret = u3nc(_mull_nice(van, gol, dis), dat);
u3z(tal);
u3z(hed);
return ret;
}
}
else switch ( u3h(gen) ) {
default: {
u3_noun ter = u3r_at(u3x_con_3, van);
u3_noun fab = u3r_at(u3qfu_van_fab, van);
u3_noun rex = u3qfp_open(ter, fab, gen);
if ( c3y == u3r_sing(rex, gen) ) {
#if 1
u3_noun zix = u3qfu_shep(van, "gene", 'q', u3k(gen));
u3t_push(u3nc(c3__mean, zix));
return u3m_error("mull-open");
#else
u3_err("h", u3h(gen));
return u3m_bail(c3__fail);
#endif
}
ret = _mull_in(van, sut, gol, dox, rex);
u3z(rex);
return ret;
}
case c3__fits: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun p_waz = u3qfu_play(van, sut, p_gen);
u3_noun q_waz = u3qfu_play(van, dox, p_gen);
u3_noun dok = u3nc(c3__wing, u3k(q_gen));
u3_noun p_syx = _mull_doke(van, sut, dok);
u3_noun q_syx = _mull_doke(van, dox, dok);
u3_noun p_pov = u3qfu_fish(van, p_waz, p_syx);
u3_noun q_pov = u3qfu_fish(van, q_waz, q_syx);
if ( (c3n == u3r_sing(p_syx, q_syx)) ||
(c3n == u3r_sing(p_pov, q_pov)) )
{
return u3m_error("mull-bonk-b");
}
u3z(p_waz); u3z(q_waz);
u3z(p_syx); u3z(q_syx);
u3z(p_pov); u3z(q_pov);
u3z(dok);
return _mull_both(van, gol, _mull_bean());
}
case c3__wthx: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun hyp = u3nc(u3nc(c3y, 1), u3k(q_gen));
u3_noun fid = u3qfu_find(van, sut, c3__free, hyp);
u3_noun gax = u3qfu_find(van, dox, c3__free, hyp);
u3_noun old_type, old_axis;
u3_noun new_type, new_axis;
{
if ( c3y != u3h(fid) ) {
return u3m_error("mull-bonk-x");
}
else {
u3_noun pp_fid = u3h(u3t(fid));
u3_noun qp_fid = u3t(u3t(fid));
if ( c3y != u3h(qp_fid) ) {
return u3m_error("mull-bonk-x");
}
new_type = u3t(qp_fid);
new_axis = _mull_tend(pp_fid);
}
}
{
if ( c3y != u3h(gax) ) {
return u3m_error("mull-bonk-x");
}
else {
u3_noun pp_gax = u3h(u3t(gax));
u3_noun qp_gax = u3t(u3t(gax));
if ( c3y != u3h(qp_gax) ) {
return u3m_error("mull-bonk-x");
}
old_type = u3t(qp_gax);
old_axis = _mull_tend(pp_gax);
}
}
if ( c3n == u3r_sing(old_axis, new_axis) ) {
return u3m_error("mull-bonk-x");
}
else if ( c3n == u3qfu_nest(van, old_type, c3y, new_type) ) {
return u3m_error("mull-bonk-x");
}
u3z(old_axis);
u3z(new_axis);
u3z(gax);
u3z(fid);
return _mull_both(van, gol, _mull_bean());
}
case c3__wtcl: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_mull_used();
{
u3_noun bol = _mull_bean();
u3_noun nor = _mull_in(van, sut, bol, dox, p_gen);
u3_noun p_fex = u3qfu_gain(van, sut, p_gen);
u3_noun q_fex = u3qfu_gain(van, dox, p_gen);
u3_noun p_wux = u3qfu_lose(van, sut, p_gen);
u3_noun q_wux = u3qfu_lose(van, dox, p_gen);
u3_noun hiq, ran;
u3_noun dis, dat;
u3_noun ret;
if ( c3__void == p_fex ) {
hiq = u3nc(c3__void,
(c3__void == q_fex)
? c3__void
: u3qfu_play(van, q_fex, q_gen));
} else if ( c3__void == q_fex ) {
hiq = u3m_error("mull-bonk-c");
}
else hiq = _mull_in(van, p_fex, gol, q_fex, q_gen);
if ( c3__void == p_wux ) {
ran = u3nc(c3__void,
(c3__void == q_wux)
? c3__void
: u3qfu_play(van, q_wux, r_gen));
} else if ( c3__void == q_wux ) {
ran = u3m_error("mull-bonk-d");
}
else ran = _mull_in(van, p_wux, gol, q_wux, r_gen);
dis = u3qf_forq(u3h(hiq), u3h(ran));
dat = u3qf_forq(u3t(hiq), u3t(ran));
ret = u3nc(_mull_nice(van, gol, dis), dat);
u3z(ran);
u3z(hiq);
u3z(q_wux);
u3z(p_wux);
u3z(q_fex);
u3z(p_fex);
u3z(nor);
u3z(bol);
return ret;
}
case c3__clhp: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun hed = _mull_in(van, sut, c3__noun, dox, p_gen);
u3_noun tal = _mull_in(van, sut, c3__noun, dox, q_gen);
u3_noun dis = u3qf_cell(u3h(hed), u3h(tal));
u3_noun dat = u3qf_cell(u3t(hed), u3t(tal));
u3_noun ret = u3nc(_mull_nice(van, gol, dis), dat);
u3z(tal);
u3z(hed);
return ret;
}
case c3__dtts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun hed = _mull_in(van, sut, c3__noun, dox, p_gen);
u3_noun tal = _mull_in(van, sut, c3__noun, dox, q_gen);
u3z(hed);
u3z(tal);
return _mull_both(van, gol, _mull_bean());
}
case c3__dtwt: p_gen = u3t(gen);
_mull_used();
{
u3_noun vay = _mull_in(van, sut, c3__noun, dox, p_gen);
u3z(vay);
return _mull_both(van, gol, _mull_bean());
}
case c3__dtkt: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun nog = u3nc(c3__kttr, u3k(p_gen));
u3_noun vay = _mull_in(van, sut, c3__noun, dox, q_gen);
u3_noun ret;
u3z(vay);
ret = _mull_in(van, sut, gol, dox, nog);
u3z(nog);
return ret;
}
case c3__dtls: p_gen = u3t(gen);
_mull_used();
{
u3_noun wuq = u3nt(c3__atom, u3_blip, u3_nul);
u3_noun vay = _mull_in(van, sut, wuq, dox, p_gen);
u3z(vay);
return _mull_both(van, gol, wuq);
}
case c3__rock: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun typ = u3qfu_play(van, sut, gen);
return _mull_both(van, gol, typ);
}
case c3__dttr: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun hed = _mull_in(van, sut, c3__noun, dox, p_gen);
u3_noun tal = _mull_in(van, sut, c3__noun, dox, q_gen);
u3z(hed);
u3z(tal);
return _mull_both(van, gol, c3__noun);
}
case c3__sand: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun typ = u3qfu_play(van, sut, gen);
return _mull_both(van, gol, typ);
}
case c3__hand: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
return u3nc(u3k(p_gen), u3k(p_gen));
}
case c3__ktbr: p_gen = u3t(gen);
_mull_used();
{
u3_noun vat = _mull_in(van, sut, gol, dox, p_gen);
u3_noun pro = u3nc(u3qfu_wrap(van,
u3h(vat),
c3__iron),
u3qfu_wrap(van,
u3t(vat),
c3__iron));
u3z(vat);
return pro;
}
case c3__ktpd:
case c3__ktpm: p_gen = u3t(gen);
_mull_used();
{
u3_noun vat = _mull_in(van, sut, gol, dox, p_gen);
u3_noun pro = u3nc(u3qfu_wrap(van,
u3h(vat),
c3__zinc),
u3qfu_wrap(van,
u3t(vat),
c3__zinc));
u3z(vat);
return pro;
}
case c3__ktwt: p_gen = u3t(gen);
_mull_used();
{
u3_noun vat = _mull_in(van, sut, gol, dox, p_gen);
u3_noun pro = u3nc(u3qfu_wrap(van,
u3h(vat),
c3__lead),
u3qfu_wrap(van,
u3t(vat),
c3__lead));
u3z(vat);
return pro;
}
case c3__note: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun vat = _mull_in(van, sut, gol, dox, q_gen);
u3_noun hit = u3nc(u3k(sut), u3k(p_gen));
u3_noun hix = u3nc(u3k(dox), u3k(p_gen));
u3_noun ret = u3nc(u3qf_hint(hit, u3h(vat)),
u3qf_hint(hix, u3t(vat)));
u3z(hix);
u3z(hit);
u3z(vat);
return ret;
}
case c3__tune: p_gen = u3t(gen);
_mull_used();
{
return u3nc(u3qf_face(p_gen, sut),
u3qf_face(p_gen, dox));
}
case c3__ktsg: p_gen = u3t(gen);
_mull_used();
{
return _mull_in(van, sut, gol, dox, p_gen);
}
case c3__ktls: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun p_hif = _mull_nice(van, gol, u3qfu_play(van, sut, p_gen));
u3_noun q_hif = u3qfu_play(van, dox, p_gen);
u3_noun zel = _mull_in(van, sut, p_hif, dox, q_gen);
u3_noun ret = u3nc(p_hif, q_hif);
u3z(zel);
return ret;
}
case c3__tsbn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun lem = _mull_in(van, sut, c3__noun, dox, p_gen);
u3_noun p_lem = u3h(lem);
u3_noun q_lem = u3t(lem);
u3_noun ret = _mull_in(van, p_lem, gol, q_lem, q_gen);
u3z(lem);
return ret;
}
case c3__tscm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun boc = u3qfu_busk(van, sut, p_gen);
u3_noun nuf = u3qfu_busk(van, dox, p_gen);
u3_noun ret = _mull_in(van, boc, gol, nuf, q_gen);
u3z(boc);
u3z(nuf);
return ret;
}
case c3__cnts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
return _mull_cnts(van, sut, gol, dox, p_gen, q_gen);
}
case c3__brcn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
ret = _mull_grow
(van, sut, gol, dox, c3__gold, p_gen, c3__dry, ruf, q_gen);
u3z(ruf);
return ret;
}
case c3__brvt: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
ret = _mull_grow
(van, sut, gol, dox, c3__gold, p_gen, c3__wet, ruf, q_gen);
u3z(ruf);
return ret;
}
case c3__sgzp: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun typ = u3qfu_play(van, sut, p_gen);
u3_noun dug = u3qfu_duck(van, typ);
u3_noun ret;
u3t_push(u3nc(c3__mean, dug));
{
ret = _mull_in(van, sut, gol, dox, q_gen);
}
u3t_drop();
u3z(typ);
return ret;
}
case c3__sgbn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
return _mull_in(van, sut, gol, dox, q_gen);
}
case c3__zpcm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun p_ret = u3qfu_play(van, sut, p_gen);
u3_noun q_ret = u3qfu_play(van, sut, q_gen);
return u3nc(_mull_nice(van, gol, p_ret),
q_ret);
}
case c3__dbug: u3x_cell(u3t(gen), &p_gen, &q_gen);
{
u3_noun ret;
u3t_push(u3nc(c3__mean, _mull_loc(van, p_gen)));
{
ret = _mull_in(van, sut, gol, dox, q_gen);
}
u3t_drop();
return ret;
}
case c3__zpts: p_gen = u3t(gen);
_mull_used();
{
return _mull_both(van, gol, c3__noun);
}
case c3__ktcn: p_gen = u3t(gen);
_mull_used();
{
u3_noun von = u3i_molt(u3k(van), u3qfu_van_fab, c3n, 0);
u3_noun ret = _mull_in(von, sut, gol, dox, p_gen);
u3z(von);
return ret;
}
case c3__zpmc:
case c3__zpsm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun p_zur = u3qfu_play(van, sut, p_gen);
u3_noun q_zur = u3qfu_play (van, dox, p_gen);
u3_noun vos = _mull_in(van, sut, c3__noun, dox, q_gen);
u3_noun p_ret = u3qf_cell(p_zur, u3h(vos));
u3_noun q_ret = u3qf_cell(q_zur, u3t(vos));
u3z(vos);
u3z(q_zur);
u3z(p_zur);
return u3nc
(_mull_nice(van, gol, p_ret), q_ret);
}
case c3__zpvt: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_mull_used();
{
c3_o fes = _mull_feel(van, sut, p_gen);
c3_o fed = _mull_feel(van, dox, p_gen);
if ( fes != fed ) {
return u3m_error("mull-bonk-f");
}
else {
if ( c3y == fes ) {
return _mull_in(van, sut, gol, dox, q_gen);
} else {
return _mull_in(van, sut, gol, dox, r_gen);
}
}
}
case c3__lost:
case c3__fail:
case c3__zpzp:
_mull_used();
{
return u3nc(c3__void, c3__void);
}
}
}
static u3_noun
_cqfu_mull(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_noun gen)
{
return _mull_in(van, sut, gol, dox, gen);
}
/* boilerplate
*/
u3_noun
u3wfu_mull(u3_noun cor)
{
u3_noun sut, gol, dox, gen, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &gol,
u3x_sam_6, &dox,
u3x_sam_7, &gen,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_mull(van, sut, gol, dox, gen);
}
}
u3_noun
u3qfu_mull(u3_noun van,
u3_noun sut,
u3_noun gol,
u3_noun dox,
u3_noun gen)
{
c3_m fun_m = 141 + c3__mull + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_4(fun_m, sut, gol, dox, gen);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_mull(van, sut, gol, dox, gen);
return u3z_save_4(fun_m, sut, gol, dox, gen, pro);
}
}

View File

@ -1,560 +0,0 @@
/* j/6/ut_nest.c
**
*/
#include "all.h"
/* logic
*/
/* forward
*/
static u3_noun
_nest_sint(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_nest_dext(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_nest_deep(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref,
u3_noun dab,
u3_noun hem,
u3_noun gil)
{
if ( u3_nul == dab ) {
return u3r_sing(u3_nul, hem);
} else if ( u3_nul == hem ) {
return c3n;
} else {
u3_noun n_dab, l_dab, r_dab;
u3_noun n_hem, l_hem, r_hem;
u3_noun pn_hem, qn_hem, pn_dab, qn_dab;
u3x_trel(dab, &n_dab, &l_dab, &r_dab);
u3x_trel(hem, &n_hem, &l_hem, &r_hem);
if ( (c3n == _nest_deep(van, sut, tel, ref, l_dab, l_hem, gil)) ||
(c3n == _nest_deep(van, sut, tel, ref, r_dab, r_hem, gil)) )
{
return c3n;
}
u3x_cell(n_dab, &pn_dab, &qn_dab);
u3x_cell(n_hem, &pn_hem, &qn_hem);
if ( c3n == u3r_sing(pn_dab, pn_hem) ) {
return c3n;
}
else {
u3_noun vis = u3qfu_play(van, sut, qn_dab);
u3_noun lon = u3qfu_play(van, ref, qn_hem);
u3_noun ret = _nest_dext(van, vis, tel, lon, u3_nul, u3_nul, gil);
u3z(vis);
u3z(lon);
return ret;
}
}
}
static u3_noun
_nest_dope(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref,
u3_noun dom,
u3_noun vim,
u3_noun gil)
{
if ( u3_nul == dom ) {
return u3r_sing(u3_nul, vim);
} else if ( u3_nul == vim ) {
return c3n;
} else {
u3_noun n_dom, l_dom, r_dom;
u3_noun n_vim, l_vim, r_vim;
u3_noun pn_vim, qn_vim, pn_dom, qn_dom;
u3_noun pqn_vim, qqn_vim, pqn_dom, qqn_dom;
u3x_trel(dom, &n_dom, &l_dom, &r_dom);
u3x_trel(vim, &n_vim, &l_vim, &r_vim);
if ( (c3n == _nest_dope(van, sut, tel, ref, l_dom, l_vim, gil)) ||
(c3n == _nest_dope(van, sut, tel, ref, r_dom, r_vim, gil)) )
{
return c3n;
}
u3x_cell(n_dom, &pn_dom, &qn_dom);
u3x_cell(n_vim, &pn_vim, &qn_vim);
u3x_cell(qn_dom, &pqn_dom, &qqn_dom);
u3x_cell(qn_vim, &pqn_vim, &qqn_vim);
if ( c3n == u3r_sing(pn_dom, pn_vim) ) {
return c3n;
} else {
return _nest_deep(van, sut, tel, ref, qqn_dom, qqn_vim, gil);
}
}
}
static u3_noun
_nest_cong(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref,
u3_noun gil)
{
u3_noun p_sut, q_sut, p_ref, q_ref;
u3_noun pq_sut, qq_sut, rq_sut;
u3_noun pq_ref, qq_ref, rq_ref;
u3_noun prq_sut, qrq_sut, prq_ref, qrq_ref;
u3_noun ppq_sut, qpq_sut, rpq_sut;
u3_noun ppq_ref, qpq_ref, rpq_ref;
u3_noun ret;
u3x_trel(sut, 0, &p_sut, &q_sut);
u3x_trel(ref, 0, &p_ref, &q_ref);
u3x_trel(q_sut, &pq_sut, &qq_sut, &rq_sut);
u3x_trel(q_ref, &pq_ref, &qq_ref, &rq_ref);
u3x_trel(pq_sut, &ppq_sut, &qpq_sut, &rpq_sut);
u3x_trel(pq_ref, &ppq_ref, &qpq_ref, &rpq_ref);
u3x_cell(rq_sut, &prq_sut, &qrq_sut);
u3x_cell(rq_ref, &prq_ref, &qrq_ref);
if ( c3y == u3r_sing(q_sut, q_ref) ) {
return _nest_dext(van, p_sut, tel, p_ref, u3_nul, u3_nul, gil);
}
else if ( c3n == u3r_sing(qpq_sut, qpq_ref) ) {
return c3n;
}
else if ( (c3n == _nest_dext
(van, qq_sut, tel, p_sut, u3_nul, u3_nul, gil)) ||
(c3n == _nest_dext
(van, p_sut, tel, qq_sut, u3_nul, u3_nul, gil)) ||
(c3n == _nest_dext
(van, qq_ref, tel, p_ref, u3_nul, u3_nul, gil)) )
{
return c3n;
}
else {
if ( (rpq_sut != rpq_ref) &&
(c3__lead != rpq_sut) &&
(c3__gold != rpq_ref) )
{
return c3n;
}
else if ( c3__wet == qpq_sut ) {
return u3r_sing(qrq_sut, qrq_ref);
}
else {
u3_noun hud = u3nc(u3k(sut), u3k(ref));
if ( (c3y == u3qdi_has(gil, hud)) ) {
u3z(hud);
return c3y;
}
else {
u3_noun zoc = u3qdi_put(gil, hud);
u3_noun tus = u3nt(c3__core,
u3k(qq_sut),
u3nc(u3nt(u3k(ppq_sut), u3k(qpq_sut), c3__gold),
u3k(u3t(q_sut))));
u3_noun fer = u3nt(c3__core,
u3k(qq_ref),
u3nc(u3nt(u3k(ppq_ref), u3k(qpq_ref), c3__gold),
u3k(u3t(q_ref))));
ret = _nest_dope(van, tus, tel, fer, qrq_sut, qrq_ref, zoc);
u3z(fer);
u3z(tus);
u3z(zoc);
u3z(hud);
if ( c3n == ret ) {
return c3n;
}
else {
switch ( rpq_sut ) {
default: return u3m_bail(c3__fail);
case c3__gold: {
return
c3a(_nest_dext(van, qq_sut, tel, qq_ref, u3_nul, u3_nul, gil),
_nest_dext(van, qq_ref, tel, qq_sut, u3_nul, u3_nul, gil));
}
case c3__iron: {
u3_noun s_sam = u3qfu_peek(van, qq_sut, c3__rite, 2);
u3_noun r_sam = u3qfu_peek(van, qq_ref, c3__rite, 2);
u3_noun ret = _nest_dext
(van, r_sam, tel, s_sam, u3_nul, u3_nul, gil);
u3z(r_sam);
u3z(s_sam);
return ret;
}
case c3__lead: {
return c3y;
}
case c3__zinc: {
u3_noun s_pal = u3qfu_peek(van, qq_sut, c3__read, 2);
u3_noun r_pal = u3qfu_peek(van, qq_ref, c3__read, 2);
u3_noun ret = _nest_dext
(van, s_pal, tel, r_pal, u3_nul, u3_nul, gil);
u3z(r_pal);
u3z(s_pal);
return ret;
}
}
}
}
}
}
}
static u3_noun
_nest_dext_in(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref,
u3_noun seg,
u3_noun reg,
u3_noun gil)
{
u3_noun p_sut, q_sut, p_ref, q_ref;
if ( (c3n == u3du(sut)) ) switch ( sut ) {
default: return u3m_bail(c3__fail);
case c3__noun: {
return c3y;
}
case c3__void: {
return _nest_sint(van, sut, tel, ref, seg, reg, gil);
}
}
else switch ( u3h(sut) ) {
default: return u3m_bail(c3__fail);
case c3__atom: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
}
else {
if ( c3y == u3r_pq(ref, c3__atom, &p_ref, &q_ref) ) {
if ( (c3n == u3qf_fitz(p_sut, p_ref)) ||
( (c3y == u3du(q_sut)) &&
( (c3n == u3du(q_ref)) ||
(c3n == u3r_sing(q_sut, q_ref)))) )
{
return c3n;
}
return c3y;
}
return _nest_sint(van, sut, tel, ref, seg, reg, gil);
}
}
case c3__cell: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
if ( c3y == u3r_pq(ref, c3__cell, &p_ref, &q_ref) ) {
return c3a(_nest_dext(van, p_sut, tel, p_ref, u3_nul, u3_nul, gil),
_nest_dext(van, q_sut, tel, q_ref, u3_nul, u3_nul, gil));
}
else return _nest_sint(van, sut, tel, ref, seg, reg, gil);
}
}
case c3__core: {
if ( c3n == u3r_trel(sut, 0, &p_sut, &q_sut) ) {
return u3m_bail(c3__fail);
} else {
if ( (c3y == u3r_pq(ref, c3__core, &p_ref, &q_ref)) ) {
return _nest_cong(van, sut, tel, ref, gil);
}
else return _nest_sint(van, sut, tel, ref, seg, reg, gil);
}
}
case c3__hint:
case c3__face: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
return _nest_dext(van, q_sut, tel, ref, seg, reg, gil);
}
}
case c3__fork: p_sut = u3t(sut);
{
if ( c3n == u3du(ref) ) switch ( ref ) {
default: return _nest_sint(van, sut, tel, ref, seg, reg, gil);
case c3__noun:
break;
}
else switch ( u3h(ref) ) {
default: return _nest_sint(van, sut, tel, ref, seg, reg, gil);
case c3__atom:
case c3__cell:
case c3__core:
break;
}
{
u3_noun dey = u3qdi_tap(p_sut);
u3_noun yed = dey;
while ( u3_nul != yed ) {
if ( c3y == _nest_dext(van, u3h(yed), c3n, ref, seg, reg, gil) ) {
u3z(dey);
return c3y;
} else {
yed = u3t(yed);
}
}
u3z(dey);
return c3n;
}
}
case c3__hold:
{
if ( c3y == u3qdi_has(seg, sut) ) {
return c3n;
}
else {
u3_noun hud = u3nc(u3k(sut), u3k(ref));
if ( (c3y == u3qdi_has(gil, hud)) ) {
u3z(hud);
return c3y;
}
else {
u3_noun gus = u3qdi_put(seg, sut);
u3_noun zoc = u3qdi_put(gil, hud);
u3_noun fop = u3qfu_repo(van, sut);
u3_noun hiv = _nest_dext(van, fop, tel, ref, gus, reg, zoc);
u3z(hud);
u3z(fop);
u3z(zoc);
u3z(gus);
return hiv;
}
}
}
}
}
static u3_noun
_nest_dext_to(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref,
u3_noun seg,
u3_noun reg,
u3_noun gil)
{
u3_noun tyn = _nest_dext_in(van, sut, tel, ref, seg, reg, gil);
if ( (c3y == tyn) || (c3n == tel) ) {
return tyn;
} else {
#if 0
u3_noun dun = u3qfu_dunq(van, "need", sut);
u3_noun niz = u3qfu_dunq(van, "have", ref);
u3t_push(u3nc(c3__mean, dun));
u3t_push(u3nc(c3__mean, niz));
#endif
return u3m_error("nest-fail");
}
}
static u3_noun
_nest_dext(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref,
u3_noun seg,
u3_noun reg,
u3_noun gil)
{
if ( (c3y == u3r_sing(sut, ref)) ) {
return c3y;
}
{
c3_m fun_m = 141 + c3__nest + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, ref);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _nest_dext_to(van, sut, tel, ref, seg, reg, gil);
if ( ((c3y == pro) && (u3_nul == reg)) ||
((c3n == pro) && (u3_nul == seg)) )
{
return u3z_save_2(fun_m, sut, ref, pro);
}
else return pro;
}
}
}
static u3_noun
_nest_sint(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref,
u3_noun seg,
u3_noun reg,
u3_noun gil)
{
u3_noun p_ref, q_ref;
if ( (c3n == u3du(ref)) ) {
switch ( ref ) {
default: return u3m_bail(c3__fail);
case c3__noun: return c3n;
case c3__void: return c3y;
}
}
else {
switch ( u3h(ref) ) {
default: {
return u3m_bail(c3__fail);
}
case c3__atom: return c3n;
case c3__cell: return c3n;
case c3__core: {
u3_noun gam = u3qfu_repo(van, ref);
u3_noun hiv = _nest_dext(van, sut, tel, gam, seg, reg, gil);
u3z(gam);
return hiv;
}
case c3__hint:
case c3__face: {
if ( c3n == u3r_trel(ref, 0, &p_ref, &q_ref) ) {
return u3m_bail(c3__fail);
} else {
return _nest_dext(van, sut, tel, q_ref, seg, reg, gil);
}
}
case c3__fork: p_ref = u3t(ref);
{
u3_noun dey = u3qdi_tap(p_ref);
u3_noun yed = dey;
while ( u3_nul != yed ) {
if ( c3n == _nest_dext(van, sut, c3n, u3h(yed), seg, reg, gil) ) {
u3z(dey);
return c3n;
} else {
yed = u3t(yed);
}
}
u3z(dey);
return c3y;
}
case c3__hold: {
if ( c3y == u3qdi_has(reg, ref) ) {
return c3y;
}
{
u3_noun hud = u3nc(u3k(sut), u3k(ref));
if ( (c3y == u3qdi_has(gil, hud)) ) {
u3z(hud);
return c3y;
} else {
u3_noun gur = u3qdi_put(reg, ref);
u3_noun zoc = u3qdi_put(gil, hud);
u3_noun gam = u3qfu_repo(van, ref);
{
u3_noun hiv = _nest_dext(van, sut, tel, gam, seg, gur, zoc);
u3z(hud);
u3z(gam);
u3z(zoc);
u3z(gur);
return hiv;
}
}
}
}
}
}
}
static u3_noun
_cqfu_nest(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref)
{
return _nest_dext(van, sut, tel, ref, u3_nul, u3_nul, u3_nul);
}
/* boilerplate
*/
u3_noun
u3wfu_nest(u3_noun cor)
{
u3_noun sut, tel, ref, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &tel,
u3x_sam_3, &ref,
u3x_con, &van,
0)) ||
(c3n == u3ud(tel)) || (tel > 1) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_nest(van, sut, tel, ref);
}
}
u3_noun
u3qfu_nest(u3_noun van,
u3_noun sut,
u3_noun tel,
u3_noun ref)
{
#if 1
c3_m fun_m = 141 + c3__nest;
u3_noun vrf = u3r_at(u3qfu_van_vrf, van);
u3_noun pro = u3z_find_4(fun_m, vrf, sut, tel, ref);
if ( u3_none != pro ) {
// u3t_heck(c3__good);
return pro;
}
else {
pro = _cqfu_nest(van, sut, tel, ref);
// u3t_heck(c3__nest);
return u3z_save_4(fun_m, vrf, sut, tel, ref, pro);
}
#else
return _cqfu_nest(van, sut, tel, ref);
#endif
}

View File

@ -1,232 +0,0 @@
/* j/6/peek.c
**
*/
#include "all.h"
/* logic
*/
static u3_noun
_cqfu_peek(u3_noun, u3_noun, u3_noun, u3_atom);
static u3_noun
_peek_in(u3_noun, u3_noun, u3_noun, u3_atom, u3_noun);
static u3_noun
_peek_fork(u3_noun van, u3_noun p_sut, u3_noun way, u3_noun axe, u3_noun gil)
{
if ( u3_nul == p_sut ) {
return u3_nul;
}
else {
return u3nc(_peek_in(van, u3h(p_sut), way, axe, gil),
_peek_fork(van, u3t(p_sut), way, axe, gil));
}
}
static u3_noun
_peek_in(u3_noun van,
u3_noun sut,
u3_noun way,
u3_atom axe,
u3_noun gil)
{
u3_noun p_sut, q_sut;
u3_noun pro;
if ( (c3n == u3du(sut)) ) switch ( sut ) {
default: return u3m_bail(c3__fail);
case c3__noun: {
return c3__noun;
}
case c3__void: {
return c3__void;
}
}
else switch ( u3h(sut) ) {
default: return u3m_bail(c3__fail);
case c3__atom: {
return c3__void;
}
case c3__cell: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
u3_atom tip = u3qc_cap(axe);
u3_atom tap = u3qc_mas(axe);
if ( 2 == tip ) {
pro = _cqfu_peek(van, p_sut, way, tap);
}
else {
pro = _cqfu_peek(van, q_sut, way, tap);
}
u3z(tap);
u3z(tip);
return pro;
}
}
case c3__core: {
u3_noun pq_sut, qq_sut, rq_sut;
u3_noun ppq_sut, qpq_sut, rpq_sut;
u3_noun prq_sut, qrq_sut;
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ||
(c3n == u3r_trel(q_sut, &pq_sut, &qq_sut, &rq_sut)) ||
(c3n == u3r_trel(pq_sut, &ppq_sut, &qpq_sut, &rpq_sut)) ||
(c3n == u3r_cell(rq_sut, &prq_sut, &qrq_sut)) )
{
return u3m_bail(c3__fail);
} else {
u3_atom now = u3qc_cap(axe);
u3_atom lat = u3qc_mas(axe);
if ( 3 == now ) {
u3_noun pec = u3qfu_peel(van, sut, way, rpq_sut);
u3_noun sam = u3h(pec);
u3_noun con = u3t(pec);
u3_atom tow;
if ( 1 == lat ) {
tow = 1;
} else {
tow = u3qc_cap(lat);
}
if ( (c3y == c3a(sam, con)) ||
((c3y == sam) && (tow == 2)) ||
((c3y == con) && (tow == 3)) )
{
pro = _cqfu_peek(van, p_sut, way, lat);
}
else {
if ( way != c3__read ) {
return u3m_error("payload-block");
}
u3_noun typ;
{
u3_noun hed, tal;
if ( c3n == sam ) {
hed = c3__noun;
} else {
hed = _cqfu_peek(van, p_sut, way, 2);
}
if ( c3n == con ) {
tal = c3__noun;
} else {
tal = _cqfu_peek(van, p_sut, way, 3);
}
typ = u3qf_cell(hed, tal);
u3z(hed);
u3z(tal);
}
pro = _cqfu_peek(van, typ, way, lat);
u3z(typ);
}
u3z(pec);
u3z(tow);
}
else {
pro = c3__noun;
}
u3z(lat);
u3z(now);
return pro;
}
}
case c3__hint:
case c3__face: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
} else {
return _peek_in(van, q_sut, way, axe, gil);
}
}
case c3__fork: p_sut = u3t(sut);
{
u3_noun yed = u3qdi_tap(p_sut);
u3_noun ret = u3kf_fork(_peek_fork(van, yed, way, axe, gil));
u3z(yed);
return ret;
}
case c3__hold: {
if ( (c3y == u3qdi_has(gil, sut)) ) {
return c3__void;
}
else {
u3_noun zoc = u3qdi_put(gil, sut);
u3_noun fop = u3qfu_repo(van, sut);
u3_noun pro = _peek_in(van, fop, way, axe, zoc);
u3z(fop);
u3z(zoc);
return pro;
}
}
}
}
static u3_noun
_cqfu_peek(u3_noun van,
u3_noun sut,
u3_noun way,
u3_atom axe)
{
if ( 1 == axe ) {
return u3k(sut);
}
else return _peek_in(van, sut, way, axe, u3_nul);
}
/* boilerplate
*/
u3_noun
u3wfu_peek(u3_noun cor)
{
u3_noun sut, way, axe, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &way,
u3x_sam_3, &axe,
u3x_con, &van,
0)) ||
(c3n == u3ud(axe)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_peek(van, sut, way, axe);
}
}
u3_noun
u3qfu_peek(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun axe)
{
c3_m fun_m = 141 + c3__peek + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_3(fun_m, sut, way, axe);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_peek(van, sut, way, axe);
return u3z_save_3(fun_m, sut, way, axe, pro);
}
}

View File

@ -1,55 +0,0 @@
/* j/6/ut_peel.c
**
*/
#include "all.h"
/* logic
*/
u3_noun
_cqfu_peel(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun met)
{
if ( c3__gold == met ) {
return u3nc(c3y, c3y);
}
else switch ( way ) {
default: return u3m_bail(c3__fail);
case c3__both: return u3nc(c3n, c3n);
case c3__free: return u3nc(c3y, c3y);
case c3__read: return u3nc(((met == c3__zinc) ? c3y : c3n), c3n);
case c3__rite: return u3nc(((met == c3__iron) ? c3y : c3n), c3n);
}
}
/* boilerplate
*/
u3_noun
u3wfu_peel(u3_noun cor)
{
u3_noun sut, way, met, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &way,
u3x_sam_3, &met,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_peel(van, sut, way, met);
}
}
u3_noun
u3qfu_peel(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun met)
{
return _cqfu_peel(van, sut, way, met);
}

View File

@ -1,606 +0,0 @@
/* j/6/play.c
**
*/
#include "all.h"
/* logic
*/
# define _play_used()
static u3_noun
_play_in(u3_noun, u3_noun, u3_noun);
static u3_noun
_play_bean()
{
return u3kf_fork(u3nt(u3nq(c3__atom, 'f', u3_nul, 0),
u3nq(c3__atom, 'f', u3_nul, 1),
u3_nul));
}
static u3_noun
_play_rock(u3_noun odo, u3_noun bob)
{
if ( c3y == u3ud(bob) ) {
return u3nq(c3__atom, u3k(odo), u3_nul, u3k(bob));
}
else return u3nt(c3__cell, _play_rock(odo, u3h(bob)),
_play_rock(odo, u3t(bob)));
}
static u3_noun
_play_sand(u3_noun odo, u3_noun bob)
{
if ( c3y == u3ud(bob) ) {
if ( 'n' == odo ) {
if ( (bob != 0) ) {
return u3m_bail(c3__exit);
} else {
return u3nq(c3__atom, odo, u3_nul, bob);
}
}
if ( 'f' == odo ) {
if ( (bob > 1) ) {
return u3m_bail(c3__exit);
} else {
return _play_bean();
}
}
return u3nt(c3__atom, u3k(odo), u3_nul);
}
else return u3nt(c3__cell, _play_rock(odo, u3h(bob)),
_play_rock(odo, u3t(bob)));
}
static u3_noun
_play_core(u3_noun pac,
u3_noun con)
{
if ( (c3__void == pac) ) {
u3z(con);
return c3__void;
} else {
return u3nt(c3__core, pac, con);
}
}
static u3_noun
_play_loc(u3_noun van,
u3_noun loc)
{
u3_noun mol = u3nc('o', u3k(loc));
u3_noun sho = u3j_cook("_play_loc-show", u3k(van), "show");
u3_noun ret = u3i_molt(u3k(sho), u3x_sam, u3k(mol), 0);
u3z(mol);
u3z(sho);
return ret;
}
static u3_noun
_play_feel(u3_noun van,
u3_noun sut,
u3_noun rot)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "feel");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(rot),
0));
}
#if 0
static u3_noun
_play_loc_term(u3_noun van,
u3_noun loc)
{
u3_noun fop = u3kb_flop(u3k(u3h(loc)));
u3_noun nam = ((0 == fop) ? c3__none : u3k(u3h(fop)));
u3_noun lys = u3nt(u3k(u3h(u3t(loc))), u3k(u3t(u3t(loc))), u3_nul);
u3_noun rup = u3nc(nam, lys);
c3_c* pre_c = u3m_pretty(rup);
u3_noun pro = u3i_string(pre_c);
u3z(fop);
u3z(rup);
free(pre_c);
return pro;
}
#endif
#if 1
static u3_noun
_play_cnts(u3_noun van,
u3_noun sut,
u3_noun hyp,
u3_noun rig)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("_play_cnts-epla", von, "epla");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(hyp),
u3x_sam_3,
u3k(rig),
0));
}
#else
static u3_noun
_play_edit(u3_noun van,
u3_noun sut,
u3_noun mew,
u3_noun rag)
{
while ( 1 ) {
if ( c3n == u3du(mew) ) {
return rag;
} else {
u3_noun i_mew = u3h(mew);
u3_noun t_mew = u3t(mew);
u3_noun pi_mew = u3h(i_mew);
u3_noun qi_mew = u3t(i_mew);
u3_noun laf = _play_in(van, sut, qi_mew);
u3_noun ruz = u3qfu_toss(van, sut, pi_mew, laf, rag);
u3z(laf);
u3z(rag);
rag = u3k(u3t(ruz));
u3z(ruz);
mew = t_mew;
}
}
}
static u3_noun
_play_cnts_old(u3_noun van,
u3_noun sut,
u3_noun hyp,
u3_noun rig)
{
u3_noun lar = u3qfu_seek(van, sut, c3__read, hyp);
u3_noun q_lar = u3t(lar);
u3_noun qq_lar = u3t(q_lar);
u3_noun mew = rig;
u3_noun rag = _play_edit(van, sut, mew, u3k(qq_lar));
u3_noun ret = u3qfu_fire(van, sut, rag);
u3z(rag);
u3z(lar);
return ret;
}
#endif
static u3_noun
_play_grow(u3_noun van,
u3_noun sut,
u3_atom mel,
u3_noun nym,
u3_noun hud,
u3_noun ruf,
u3_noun dom)
{
u3_noun dan = _play_in(van, sut, ruf);
return _play_core(dan,
u3nt(u3nt(u3k(nym), u3k(hud), u3k(mel)),
u3k(dan),
u3nc(u3nc(u3nc(c3__full, u3_nul), u3_nul),
u3k(dom))));
}
static u3_noun
_play_in(u3_noun van,
u3_noun sut,
u3_noun gen);
static u3_noun
_play_x(u3_noun van,
u3_noun sut,
u3_noun gen)
{
#if 1
return _play_in(van, sut, gen);
#else
u3_noun zix = u3qfu_shep
(van, "gene", 'q', u3k(gen));
u3_noun ret;
u3t_push(u3nc(c3__mean, zix));
ret = _play_in(van, sut, gen);
u3t_drop();
return ret;
#endif
}
static u3_noun
_play_in(u3_noun van,
u3_noun sut,
u3_noun gen)
{
u3_noun p_gen, q_gen, r_gen;
if ( c3n == u3du(gen) ) {
open: {
u3_noun ter = u3r_at(u3x_con_3, van);
u3_noun fab = u3r_at(u3qfu_van_fab, van);
u3_noun rex = u3qfp_open(ter, fab, gen);
u3_noun ret;
if ( c3y == u3r_sing(rex, gen) ) {
u3_noun zix = u3qfu_shep(van, "gene", 'q', u3k(gen));
u3t_push(u3nc(c3__mean, zix));
return u3m_error("play-open-z");
}
ret = _play_x(van, sut, rex);
u3z(rex);
return ret;
}
}
else if ( c3y == u3du(u3h(gen)) ) {
_play_used();
{
u3_noun dis = _play_x(van, sut, u3h(gen));
u3_noun dat = _play_x(van, sut, u3t(gen));
u3_noun ret = u3qf_cell(dis, dat);
u3z(dis);
u3z(dat);
return ret;
}
}
else switch ( u3h(gen) ) {
default: goto open;
case c3__fits: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_bean();
}
case c3__wtcl: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_play_used();
{
u3_noun fex = u3qfu_gain(van, sut, p_gen);
u3_noun wux = u3qfu_lose(van, sut, p_gen);
u3_noun dez = (fex == c3__void) ? c3__void
: _play_x(van, fex, q_gen);
u3_noun doz = (wux == c3__void) ? c3__void
: _play_x(van, wux, r_gen);
u3_noun ret = u3qf_forq(dez, doz);
u3z(dez); u3z(doz);
u3z(fex); u3z(wux);
return ret;
}
case c3__clhp: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun dis = _play_x(van, sut, p_gen);
u3_noun dat = _play_x(van, sut, q_gen);
u3_noun ret = u3qf_cell(dis, dat);
u3z(dis);
u3z(dat);
return ret;
}
case c3__dtkt: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun nog = u3nc(c3__kttr, u3k(p_gen));
u3_noun ret = _play_x(van, sut, nog);
u3z(nog);
return ret;
}
case c3__dtwt: p_gen = u3t(gen);
_play_used();
{
return _play_bean();
}
case c3__dtts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_bean();
}
case c3__dtls: p_gen = u3t(gen);
_play_used();
{
return u3nt(c3__atom, u3_blip, u3_nul);
}
case c3__rock: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_rock(p_gen, q_gen);
}
case c3__dttr: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return c3__noun;
}
case c3__sand: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_sand(p_gen, q_gen);
}
case c3__hand: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return u3k(p_gen);
}
case c3__ktbr: p_gen = u3t(gen);
_play_used();
{
u3_noun boc = _play_x(van, sut, p_gen);
u3_noun pro = u3qfu_wrap(van, boc, c3__iron);
u3z(boc);
return pro;
}
case c3__ktpd: p_gen = u3t(gen);
_play_used();
{
u3_noun boc = _play_x(van, sut, p_gen);
u3_noun pro = u3qfu_wrap(van, boc, c3__zinc);
u3z(boc);
return pro;
}
case c3__ktwt: p_gen = u3t(gen);
_play_used();
{
u3_noun boc = _play_x(van, sut, p_gen);
u3_noun pro = u3qfu_wrap(van, boc, c3__lead);
u3z(boc);
return pro;
}
case c3__note: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun boc = _play_x(van, sut, q_gen);
u3_noun hit = u3nc(u3k(sut), u3k(p_gen));
u3_noun ret = u3qf_hint(hit, boc);
u3z(hit);
u3z(boc);
return ret;
}
case c3__tune: p_gen = u3t(gen);
_play_used();
{
return u3qf_face(p_gen, sut);
}
case c3__ktsg: p_gen = u3t(gen);
_play_used();
{
return _play_x(van, sut, p_gen);
}
case c3__ktls: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_x(van, sut, p_gen);
}
case c3__tsbn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun boc = _play_x(van, sut, p_gen);
u3_noun ret = _play_x(van, boc, q_gen);
u3z(boc);
return ret;
}
case c3__tscm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun boc = u3qfu_busk(van, sut, p_gen);
u3_noun ret = _play_x(van, boc, q_gen);
u3z(boc);
return ret;
}
case c3__cnts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_cnts(van, sut, p_gen, q_gen);
}
case c3__brcn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
u3_noun ret = _play_grow
(van, sut, c3__gold, p_gen, c3__dry, ruf, q_gen);
u3z(ruf);
return ret;
}
case c3__brvt: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
u3_noun ret = _play_grow
(van, sut, c3__gold, p_gen, c3__wet, ruf, q_gen);
u3z(ruf);
return ret;
}
case c3__sgzp: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun typ = u3qfu_play(van, sut, p_gen);
u3_noun dug = u3qfu_duck(van, typ);
u3_noun ret;
u3t_push(u3nc(c3__mean, dug));
{
ret = _play_x(van, sut, q_gen);
}
u3t_drop();
u3z(typ);
return ret;
}
case c3__sgbn: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_x(van, sut, q_gen);
}
case c3__zpts: p_gen = u3t(gen);
_play_used();
{
return c3__noun;
}
case c3__ktcn: p_gen = u3t(gen);
{
u3_noun von = u3i_molt(u3k(van), u3qfu_van_fab, c3n, 0);
u3_noun ret = _play_x(von, sut, p_gen);
u3z(von);
return ret;
}
case c3__zpcm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return _play_x(van, sut, p_gen);
}
case c3__dbug: u3x_cell(u3t(gen), &p_gen, &q_gen);
{
u3_noun ret;
#if 0
{
u3_noun cog = _play_loc_term(van, p_gen);
u3t_heck(cog);
u3z(cog);
}
#endif
u3t_push(u3nc(c3__mean, _play_loc(van, p_gen)));
{
ret = _play_x(van, sut, q_gen);
}
u3t_drop();
return ret;
}
case c3__zpmc:
case c3__zpsm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun zur = _play_x(van, sut, p_gen);
u3_noun vos = _play_x(van, sut, q_gen);
u3_noun ret = u3qf_cell(zur, vos);
u3z(zur);
u3z(vos);
return ret;
}
case c3__zpvt: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_play_used();
{
if ( c3y == _play_feel(van, sut, p_gen) ) {
return _play_x(van, sut, q_gen);
} else {
return _play_x(van, sut, r_gen);
}
}
case c3__lost:
case c3__fail:
case c3__zpzp:
_play_used();
{
return c3__void;
}
}
}
static u3_noun
_cqfu_play(u3_noun van,
u3_noun sut,
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3qfu_van_vet, c3n, 0);
u3_noun ret = _play_x(von, sut, gen);
u3z(von);
return ret;
}
/* boilerplate
*/
u3_noun
u3wfu_play(u3_noun cor)
{
u3_noun sut, gen, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &gen, u3x_con, &van, 0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_play(van, sut, gen);
}
}
u3_noun
u3qfu_play(u3_noun van,
u3_noun sut,
u3_noun gen)
{
#if 1
c3_m fun_m = 141 + c3__play;
u3_noun vrf = u3r_at(u3qfu_van_vrf, van);
u3_noun pro = u3z_find_3(fun_m, vrf, sut, gen);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_play(van, sut, gen);
return u3z_save_3(fun_m, vrf, sut, gen, pro);
}
#else
return _cqfu_play(van, sut, gen);
#endif
}

View File

@ -1,70 +0,0 @@
/* j/6/ut_repo.c
**
*/
#include "all.h"
/* logic
*/
u3_noun
u3qfu_repo(u3_noun van,
u3_noun sut)
{
u3_noun p_sut, q_sut;
if ( c3n == u3du(sut) ) switch ( sut ) {
default: return u3k(sut);
case c3__noun: {
return u3kf_fork(u3nt(u3nt(c3__atom, u3_blip, u3_nul),
u3nt(c3__cell, c3__noun, c3__noun),
u3_nul));
}
}
else switch ( u3h(sut) ) {
default: {
u3m_p("head", u3h(sut));
return u3m_error("repo-flat");
}
case c3__core: {
if ( c3n == u3r_cell(u3t(sut), &p_sut, &q_sut) ) {
return u3m_bail(c3__fail);
} else {
return u3nt(c3__cell, c3__noun, u3k(p_sut));
}
}
case c3__hint:
case c3__face: {
if ( c3n == u3r_cell(u3t(sut), &p_sut, &q_sut)) {
return u3m_bail(c3__fail);
} else {
return u3k(q_sut);
}
}
case c3__hold: {
if ( c3n == u3r_cell(u3t(sut), &p_sut, &q_sut)) {
return u3m_bail(c3__fail);
} else {
u3_noun old = u3nc(u3nc(u3k(p_sut), u3k(q_sut)), u3_nul);
u3_noun ret;
ret = u3qfu_rest(van, sut, old);
u3z(old);
return ret;
}
}
}
}
u3_noun
u3wfu_repo(u3_noun cor)
{
u3_noun sut;
if ( u3_none == (sut = u3r_at(u3x_sam, cor)) ) {
return u3m_bail(c3__fail);
} else {
return u3qfu_repo(cor, sut);
}
}

View File

@ -1,114 +0,0 @@
/* j/6/ut_rest.c
**
*/
#include "all.h"
/* logic
*/
static u3_noun
_rest_in_list(u3_noun van,
u3_noun leg)
{
if ( u3_nul == leg ) {
return u3_nul;
} else {
u3_noun i_leg = u3h(leg);
u3_noun t_leg = u3t(leg);
return u3nc(u3qfu_play(van, u3h(i_leg), u3t(i_leg)),
_rest_in_list(van, t_leg));
}
}
static u3_noun
_rest_in_stil(u3_noun van,
u3_noun gar)
{
u3_noun gun = u3qdi_gas(u3_nul, gar);
u3_noun yed = u3qdi_tap(gun);
u3z(gun);
return yed;
}
static u3_noun
_rest_in(u3_noun van,
u3_noun leg)
{
u3_noun gar = _rest_in_list(van, leg);
u3_noun yed = _rest_in_stil(van, gar);
u3_noun fub = u3qf_fork(yed);
u3z(gar);
u3z(yed);
return fub;
}
static u3_noun
_rest_hit_fan(u3_noun fan,
u3_noun leg)
{
if ( u3_nul == leg ) {
return c3n;
} else {
return c3o(u3qdi_has(fan, u3h(leg)),
_rest_hit_fan(fan, u3t(leg)));
}
}
static u3_noun
_cqfu_rest(u3_noun van,
u3_noun sut,
u3_noun leg)
{
u3_noun fan = u3r_at(u3qfu_van_fan, van);
if ( c3y == _rest_hit_fan(fan, leg) ) {
return u3m_error("rest-loop");
}
else {
u3_noun naf = u3qdi_gas(fan, leg);
u3_noun nav = u3i_molt(u3k(van), u3qfu_van_fan, u3k(naf), 0);
u3_noun mez = _rest_in(nav, leg);
u3z(naf);
u3z(nav);
return mez;
}
}
/* boilerplate
*/
u3_noun
u3wfu_rest(u3_noun cor)
{
u3_noun sut, leg, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &leg, u3x_con, &van, 0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_rest(van, sut, leg);
}
}
u3_noun
u3qfu_rest(u3_noun van,
u3_noun sut,
u3_noun leg)
{
c3_m fun_m = 141 + c3__rest + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
u3_noun pro = u3z_find_2(fun_m, sut, leg);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_rest(van, sut, leg);
return u3z_save_2(fun_m, sut, leg, pro);
}
}

View File

@ -1,21 +0,0 @@
/* j/6/tack.c
**
*/
#include "all.h"
u3_noun
u3qfu_tack(u3_noun van,
u3_noun sut,
u3_noun hyp,
u3_noun mur)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_cook("u3qfu_tack-tack", von, "tack");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(hyp),
u3x_sam_3,
u3k(mur),
0));
}

View File

@ -1,97 +0,0 @@
/* j/6/toss.c
**
*/
#include "all.h"
/* internals
*/
static u3_noun
_toss_in(u3_noun van,
u3_noun sut,
u3_noun peh,
u3_noun mur,
u3_noun men)
{
if ( c3n == u3du(men) ) {
return u3nc(u3_nul, u3_nul);
}
else {
u3_noun i_men = u3h(men);
u3_noun pi_men = u3h(i_men);
u3_noun qi_men = u3t(i_men);
u3_noun t_men = u3t(men);
u3_noun geq = u3qfu_tack(van, pi_men, peh, mur);
u3_noun p_geq = u3h(geq);
u3_noun q_geq = u3t(geq);
u3_noun mox = _toss_in(van, sut, peh, mur, t_men);
u3_noun p_mox = u3h(mox);
u3_noun q_mox = u3t(mox);
u3_noun ret;
ret = u3nc(
( (u3_nul == p_mox)
? u3nc(u3_nul, u3k(p_geq))
: (c3n == u3r_sing(p_geq, u3t(p_mox)))
? u3m_bail(c3__exit)
: u3k(p_mox) ),
u3nc(u3nc(u3k(q_geq), u3k(qi_men)), u3k(q_mox)));
u3z(mox);
u3z(geq);
return ret;
}
}
/* functions
*/
u3_noun
_cqfu_toss(u3_noun van,
u3_noun sut,
u3_noun peh,
u3_noun mur,
u3_noun men)
{
u3_noun wib = _toss_in(van, sut, peh, mur, men);
u3_noun p_wib = u3h(wib);
u3_noun q_wib = u3t(wib);
if ( u3_nul == p_wib ) {
return u3m_bail(c3__exit);
} else {
u3_noun ret = u3nc(u3k(u3t(p_wib)), u3k(q_wib));
u3z(wib);
return ret;
}
}
/* boilerplate
*/
u3_noun
u3wfu_toss(u3_noun cor)
{
u3_noun van, sut, peh, mur, men;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &peh,
u3x_sam_6, &mur,
u3x_sam_7, &men,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_toss(van, sut, peh, mur, men);
}
}
u3_noun
u3qfu_toss(u3_noun van,
u3_noun sut,
u3_noun peh,
u3_noun mur,
u3_noun men)
{
return _cqfu_toss(van, sut, peh, mur, men);
}

View File

@ -1,97 +0,0 @@
/* j/6/wrap.c
**
*/
#include "all.h"
static u3_noun _cqfu_wrap(u3_noun, u3_noun, u3_noun);
static u3_noun
_wrap_fork(u3_noun van, u3_noun p_sut, u3_noun yoz)
{
if ( u3_nul == p_sut ) {
return u3_nul;
}
else {
return u3nc(_cqfu_wrap(van, u3h(p_sut), yoz),
_wrap_fork(van, u3t(p_sut), yoz));
}
}
static u3_noun
_cqfu_wrap(u3_noun van,
u3_noun sut,
u3_noun yoz)
{
u3_noun p_sut, q_sut;
if ( c3n == u3du(sut) ) {
return u3m_error("wrap-type");
}
else switch ( u3h(sut) ) {
default: return u3m_error("wrap-type");
case c3__core: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3_noun pq_sut, qq_sut, rq_sut;
u3_noun ppq_sut, qpq_sut, rpq_sut;
if ( c3n == u3r_trel(q_sut, &pq_sut, &qq_sut, &rq_sut) ) {
return u3m_bail(c3__fail);
}
if ( c3n == u3r_trel(pq_sut, &ppq_sut, &qpq_sut, &rpq_sut) ) {
return u3m_bail(c3__fail);
}
else if ( (c3__gold != rpq_sut) &&
(c3__lead != yoz) ) {
return u3m_error("wrap-metal");
}
else {
return u3nt(c3__core,
u3k(p_sut),
u3nt(u3nt(u3k(ppq_sut), u3k(qpq_sut), u3k(yoz)),
u3k(qq_sut),
u3k(rq_sut)));
}
}
case c3__fork: p_sut = u3t(sut);
{
u3_noun yed = u3qdi_tap(p_sut);
u3_noun ret = u3kf_fork(_wrap_fork(van, yed, yoz));
u3z(yed);
return ret;
}
case c3__hold:
{
u3_noun fop = u3qfu_repo(van, sut);
u3_noun pro = _cqfu_wrap(van, fop, yoz);
u3z(fop);
return pro;
}
}
}
/* boilerplate
*/
u3_noun
u3wfu_wrap(u3_noun cor)
{
u3_noun sut, yoz, van;
if ( (c3n == u3r_mean(cor, u3x_sam, &yoz, u3x_con, &van, 0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_wrap(van, sut, yoz);
}
}
u3_noun
u3qfu_wrap(u3_noun van,
u3_noun sut,
u3_noun yoz)
{
return _cqfu_wrap(van, sut, yoz);
}