Eliminate snubbing.

This commit is contained in:
C. Guy Yarvin 2015-12-26 06:44:32 -05:00
parent 03a6bc7f29
commit 4651852406
9 changed files with 111 additions and 113 deletions

View File

@ -316,7 +316,7 @@ J_F_OFILES_UT=\
jets/f/ut_seek.o \ jets/f/ut_seek.o \
jets/f/ut_swab.o \ jets/f/ut_swab.o \
jets/f/ut_tack.o \ jets/f/ut_tack.o \
jets/f/ut_tock.o \ jets/f/ut_toss.o \
jets/f/ut_wrap.o jets/f/ut_wrap.o
J_G_OFILES=\ J_G_OFILES=\

View File

@ -226,5 +226,5 @@
u3_noun u3qfu_sift(u3_noun, u3_noun, u3_noun); u3_noun u3qfu_sift(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_snub(u3_noun, u3_noun, u3_noun); u3_noun u3qfu_snub(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_tack(u3_noun, u3_noun, u3_noun, u3_noun); u3_noun u3qfu_tack(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_tock(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun); u3_noun u3qfu_toss(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_wrap(u3_noun, u3_noun, u3_noun); u3_noun u3qfu_wrap(u3_noun, u3_noun, u3_noun);

View File

@ -237,7 +237,7 @@
u3_noun u3wfu_seek(u3_noun); u3_noun u3wfu_seek(u3_noun);
u3_noun u3wfu_seep(u3_noun); u3_noun u3wfu_seep(u3_noun);
u3_noun u3wfu_snub(u3_noun); u3_noun u3wfu_snub(u3_noun);
u3_noun u3wfu_tock(u3_noun); u3_noun u3wfu_toss(u3_noun);
u3_noun u3wfu_wrap(u3_noun); u3_noun u3wfu_wrap(u3_noun);

View File

@ -168,7 +168,7 @@ int FOO;
u3_noun zil = u3qfu_mint(van, sut, c3__noun, qi_mew); u3_noun zil = u3qfu_mint(van, sut, c3__noun, qi_mew);
u3_noun p_zil = u3h(zil); u3_noun p_zil = u3h(zil);
u3_noun q_zil = u3t(zil); u3_noun q_zil = u3t(zil);
u3_noun wip = u3qfu_tock(van, sut, pi_mew, p_zil, rag); u3_noun wip = u3qfu_toss(van, sut, pi_mew, p_zil, rag);
u3z(rag); u3z(rag);
rag = u3k(u3t(wip)); rag = u3k(u3t(wip));
@ -648,7 +648,7 @@ int FOO;
u3_noun q_lar = u3t(lar); u3_noun q_lar = u3t(lar);
u3_noun pq_lar = u3h(q_lar); u3_noun pq_lar = u3h(q_lar);
u3_noun qq_lar = u3t(q_lar); u3_noun qq_lar = u3t(q_lar);
u3_noun mew = u3qfu_snub(van, sut, q_gen); u3_noun mew = q_gen;
u3_noun yom = _mint_edit(van, sut, mew, p_lar, u3k(qq_lar), u3_nul); u3_noun yom = _mint_edit(van, sut, mew, p_lar, u3k(qq_lar), u3_nul);
u3_noun p_yom = u3h(yom); u3_noun p_yom = u3h(yom);
u3_noun q_yom = u3t(yom); u3_noun q_yom = u3t(yom);
@ -657,22 +657,10 @@ int FOO;
: u3nt(9, u3k(pq_lar), u3k(q_yom))); : u3nt(9, u3k(pq_lar), u3k(q_yom)));
u3z(yom); u3z(yom);
u3z(mew);
u3z(lar); u3z(lar);
return ret; return ret;
} }
case c3__pmcl: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun ruf = u3nt(c3__clhp,
u3nc(u3_nul, 1),
u3k(p_gen));
u3_noun ret = _mint_grow(van, sut, gol, c3__zinc, ruf, q_gen);
u3z(ruf);
return ret;
}
case c3__brcn: p_gen = u3t(gen); case c3__brcn: p_gen = u3t(gen);
_mint_used(); _mint_used();
{ {
@ -683,27 +671,6 @@ int FOO;
return ret; return ret;
} }
case c3__pmcn: p_gen = u3t(gen);
_mint_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
ret = _mint_grow(van, sut, gol, c3__lead, ruf, p_gen);
u3z(ruf);
return ret;
}
case c3__pmls: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun ruf = u3nt(c3__clhp,
u3nc(u3_nul, 1),
u3k(p_gen));
u3_noun ret = _mint_grow(van, sut, gol, c3__iron, ruf, q_gen);
u3z(ruf);
return ret;
}
case c3__sgzp: u3x_cell(u3t(gen), &p_gen, &q_gen); case c3__sgzp: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used(); _mint_used();
{ {

View File

@ -247,8 +247,8 @@
u3_noun zil = _mull_in(van, sut, c3__noun, dox, qi_mew); u3_noun zil = _mull_in(van, sut, c3__noun, dox, qi_mew);
u3_noun p_zil = u3h(zil); u3_noun p_zil = u3h(zil);
u3_noun q_zil = u3t(zil); u3_noun q_zil = u3t(zil);
u3_noun cuf = u3qfu_tock(van, sut, pi_mew, p_zil, p_yom); u3_noun cuf = u3qfu_toss(van, sut, pi_mew, p_zil, p_yom);
u3_noun dof = u3qfu_tock(van, sut, pi_mew, q_zil, q_yom); u3_noun dof = u3qfu_toss(van, sut, pi_mew, q_zil, q_yom);
if ( u3r_sing(u3h(cuf), u3h(dof)) ) { if ( u3r_sing(u3h(cuf), u3h(dof)) ) {
u3m_error("mull-bonk-a"); u3m_error("mull-bonk-a");
@ -611,7 +611,7 @@
u3m_error("mull-bonk-e"); u3m_error("mull-bonk-e");
} }
{ {
u3_noun mew = u3qfu_snub(van, sut, q_gen); u3_noun mew = q_gen;
u3_noun yom = _mull_edit u3_noun yom = _mull_edit
(van, sut, dox, mew, u3k(qq_lar), (van, sut, dox, mew, u3k(qq_lar),
u3k(qq_vug)); u3k(qq_vug));
@ -621,24 +621,12 @@
u3z(von); u3z(von);
u3z(yom); u3z(yom);
u3z(mew);
u3z(vug); u3z(vug);
u3z(lar); u3z(lar);
return u3nc(_mull_nice(van, gol, p_ret), q_ret); return u3nc(_mull_nice(van, gol, p_ret), q_ret);
} }
} }
case c3__pmcl: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun ruf = u3nt(c3__clhp,
u3nc(u3_nul, 1),
u3k(p_gen));
u3_noun ret = _mull_grow(van, sut, gol, dox, c3__zinc, ruf, q_gen);
u3z(ruf);
return ret;
}
case c3__brcn: p_gen = u3t(gen); case c3__brcn: p_gen = u3t(gen);
_mull_used(); _mull_used();
{ {
@ -649,27 +637,6 @@
return ret; return ret;
} }
case c3__pmcn: p_gen = u3t(gen);
_mull_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
ret = _mull_grow(van, sut, gol, dox, c3__lead, ruf, p_gen);
u3z(ruf);
return ret;
}
case c3__pmls: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun ruf = u3nt(c3__clhp,
u3nc(u3_nul, 1),
u3k(p_gen));
u3_noun ret = _mull_grow(van, sut, gol, dox, c3__iron, ruf, q_gen);
u3z(ruf);
return ret;
}
case c3__sgzp: u3x_cell(u3t(gen), &p_gen, &q_gen); case c3__sgzp: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used(); _mull_used();
{ {

View File

@ -89,7 +89,7 @@
u3_noun pi_mew = u3h(i_mew); u3_noun pi_mew = u3h(i_mew);
u3_noun qi_mew = u3t(i_mew); u3_noun qi_mew = u3t(i_mew);
u3_noun laf = _play_in(van, sut, qi_mew); u3_noun laf = _play_in(van, sut, qi_mew);
u3_noun ruz = u3qfu_tock(van, sut, pi_mew, laf, rag); u3_noun ruz = u3qfu_toss(van, sut, pi_mew, laf, rag);
u3z(laf); u3z(laf);
u3z(rag); u3z(rag);
@ -346,27 +346,15 @@
u3_noun lar = _play_foil(sec); u3_noun lar = _play_foil(sec);
u3_noun q_lar = u3t(lar); u3_noun q_lar = u3t(lar);
u3_noun qq_lar = u3t(q_lar); u3_noun qq_lar = u3t(q_lar);
u3_noun mew = u3qfu_snub(van, sut, q_gen); u3_noun mew = q_gen;
u3_noun rag = _play_edit(van, sut, mew, u3k(qq_lar)); u3_noun rag = _play_edit(van, sut, mew, u3k(qq_lar));
u3_noun ret = u3qfu_fire(van, sut, rag); u3_noun ret = u3qfu_fire(van, sut, rag);
u3z(rag); u3z(rag);
u3z(mew);
u3z(lar); u3z(lar);
return ret; return ret;
} }
case c3__pmcl: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun ruf = u3nt(c3__clhp,
u3nc(u3_nul, 1),
u3k(p_gen));
u3_noun ret = _play_grow(van, sut, c3__zinc, ruf, q_gen);
u3z(ruf);
return ret;
}
case c3__brcn: p_gen = u3t(gen); case c3__brcn: p_gen = u3t(gen);
_play_used(); _play_used();
{ {
@ -376,26 +364,6 @@
u3z(ruf); u3z(ruf);
return ret; return ret;
} }
case c3__pmcn: p_gen = u3t(gen);
_play_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
u3_noun ret = _play_grow(van, sut, c3__lead, ruf, p_gen);
u3z(ruf);
return ret;
}
case c3__pmls: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun ruf = u3nt(c3__clhp,
u3nc(u3_nul, 1),
u3k(p_gen));
u3_noun ret = _play_grow(van, sut, c3__iron, ruf, q_gen);
u3z(ruf);
return ret;
}
case c3__sgzp: u3x_cell(u3t(gen), &p_gen, &q_gen); case c3__sgzp: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used(); _play_used();
{ {

View File

@ -6,7 +6,7 @@
u3_noun u3_noun
u3qfu_tack(u3_noun van, u3qfu_tack(u3_noun van,
u3_noun sut, u3_noun sut,
u3_noun peh, u3_noun hyp,
u3_noun mur) u3_noun mur)
{ {
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0); u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
@ -14,9 +14,8 @@
return u3n_kick_on(u3i_molt(gat, return u3n_kick_on(u3i_molt(gat,
u3x_sam_2, u3x_sam_2,
u3k(peh), u3k(hyp),
u3x_sam_3, u3x_sam_3,
u3k(mur), u3k(mur),
0)); 0));
} }

97
jets/f/ut_toss.c Normal file
View File

@ -0,0 +1,97 @@
/* 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

@ -368,7 +368,7 @@ static u3j_harm _mood__hoon__ut_rest_a[] = {{".2", u3wfu_rest}, {}};
static u3j_harm _mood__hoon__ut_seek_a[] = {{".2", u3wfu_seek}, {}}; static u3j_harm _mood__hoon__ut_seek_a[] = {{".2", u3wfu_seek}, {}};
static u3j_harm _mood__hoon__ut_seep_a[] = {{".2", u3wfu_seep}, {}}; static u3j_harm _mood__hoon__ut_seep_a[] = {{".2", u3wfu_seep}, {}};
static u3j_harm _mood__hoon__ut_snub_a[] = {{".2", u3wfu_snub}, {}}; static u3j_harm _mood__hoon__ut_snub_a[] = {{".2", u3wfu_snub}, {}};
static u3j_harm _mood__hoon__ut_tock_a[] = {{".2", u3wfu_tock}, {}}; static u3j_harm _mood__hoon__ut_toss_a[] = {{".2", u3wfu_toss}, {}};
static u3j_harm _mood__hoon__ut_wrap_a[] = {{".2", u3wfu_wrap}, {}}; static u3j_harm _mood__hoon__ut_wrap_a[] = {{".2", u3wfu_wrap}, {}};
static u3j_core _mood__hoon__ut_d[] = static u3j_core _mood__hoon__ut_d[] =
@ -394,7 +394,7 @@ static u3j_core _mood__hoon__ut_d[] =
{ "seek", _mood__hoon__ut_seek_a }, { "seek", _mood__hoon__ut_seek_a },
{ "seep", _mood__hoon__ut_seep_a }, { "seep", _mood__hoon__ut_seep_a },
{ "snub", _mood__hoon__ut_snub_a }, { "snub", _mood__hoon__ut_snub_a },
{ "tock", _mood__hoon__ut_tock_a }, { "toss", _mood__hoon__ut_toss_a },
{ "wrap", _mood__hoon__ut_wrap_a }, { "wrap", _mood__hoon__ut_wrap_a },
{} {}
}; };